Just changed my PC, installed the latest generator-sharepoint, performed a git clone on my repository and on some projects this error messages kept on coming up when I'm trying to build(gulp serve) the project and I'm not sure on what's causing this issue. The project is on GA release. I tried to upgrade it to June release and the error still persists. Typescript version on tslint is 2.1.6. Any idea on what's going on?
Update:
I have managed to fix it by checking the version of @types/sharepoint on my old computer (2013.1.6) and the current version is (2013.1.9), I rolled back the version to 2013.1.6 and it works fine on my GA release project. I'm not exactly sure whether this way of changing to old version is actually right, but it works.
````
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3604,17): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3823,17): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3825,19): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3827,21): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3829,18): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3896,21): error TS1005: ',' expected.
[09:00:22] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3944,31): error TS1005: ',' expected.
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(70,42): error TS2314: Generic type 'ListItem
argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3098,31): error TS2314: Generic type 'ListItem
e argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3362,33): error TS2314: Generic type 'ListItem
e argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3468,33): error TS2314: Generic type 'ListItem
e argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3604,19): error TS2368: Type parameter name cannot be 'any'
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3606,33): error TS2314: Generic type 'ListItem
e argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3816,39): error TS2314: Generic type 'ListItemCollection
ires 2 type argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3818,61): error TS2314: Generic type 'ListItem
e argument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3821,59): error TS2314: Generic type 'List
gument(s).
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3823,19): error TS2368: Type parameter name cannot be 'any'
[09:00:24] Error - typescript - node_modules\@types\sharepoint\index.d.ts(3823,40): error TS2314: Generic type 'List
gument(s).
```
Same for me...
Sounds like the latest version of @types/sharepoint is expecting a newer version of the TypeScript compiler. We will be releasing a new drop of the build tools supporting a newer version of the compiler soon, but for now the best workaround is to stay on the older (2013.1.6) version.
Encountered same issue.
Fix:
If you already have installed the latest version, uninstall the version from the solution:
npm uninstall @types/sharepoint
Use the last working version (2013.1.6):
npm install @types/[email protected] --save-dev
I have encountered similar issue. As per your suggestion used 2013.1.6 version.
But now in browser I get error "ERROR ReferenceError: SP is not defined"
I have defined types in tsconfig.json
@nigadeshshank are you loading SP JSOM yourself? While it is present on classic SharePoint pages, it's not available by default on modern pages and in the workbench and you have to load it yourself before you can use it.
@waldekmastykarz ohh ok.. Thanks. This makes sense. But yesterday I was going through MS documentation and it seems JSOM is not on their agenda anymore but REST is. So I will try to move away from JSOM anyway. But let me give a try for it. Thanks again
REST is definitely the recommended approach as newer APIs are not included in JSOM.
hey any update with this? we're still having to revert our version.
Which version of the SharePoint Framework are you using @kmartindale?
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues
Most helpful comment
@waldekmastykarz ohh ok.. Thanks. This makes sense. But yesterday I was going through MS documentation and it seems JSOM is not on their agenda anymore but REST is. So I will try to move away from JSOM anyway. But let me give a try for it. Thanks again