sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

@types/angular typings causing build errors

Open Fabske411 opened this issue 8 years ago • 9 comments

Cloning any spfx-angular sample and installing the @types/angular typings cause me gulp build error in the @types/angular/index.d.ts file:

Error - typescript - node_modules/@types/angular/index.d.ts(231,40): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(232,40): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1251,40): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1252,40): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1971,54): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1975,53): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1985,54): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(1990,56): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(2004,47): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(2087,21): error TS1005: ',' expected. Error - typescript - node_modules/@types/angular/index.d.ts(231,93): error TS2314: Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(232,95): error TS2314: Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1251,93): error TS2314: Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1252,95): error TS2314: Generic type 'IDirectiveFactory<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1972,26): error TS2314: Generic type 'IDirective<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1972,47): error TS2314: Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1986,14): error TS2314: Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(1987,15): error TS2314: Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2001,18): error TS2314: Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2001,45): error TS2314: Generic type 'IDirectivePrePost<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2005,18): error TS2314: Generic type 'IDirectiveCompileFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2014,15): error TS2314: Generic type 'IDirectiveLinkFn<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2014,42): error TS2314: Generic type 'IDirectivePrePost<TScope, IScope>' requires 2 type argument(s). Error - typescript - node_modules/@types/angular/index.d.ts(2087,23): error TS2368: Type parameter name cannot be 'any' Error - 'typescript' sub task errored after 2.2 s TypeScript error(s) occurred.

Tried following:

@types/angular@ latest with typescript 2.7.2

@types/[email protected] with typescript 2.3

Any suggestions?

Category

  • [x] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

Fabske411 avatar Mar 17 '18 10:03 Fabske411

I've just tried using Angular and its typings in a brand new SPFx project and everything seems to be working fine. Do you have a specific sample that we could try to repro the issue you're seeing?

waldekmastykarz avatar Mar 17 '18 17:03 waldekmastykarz

my mistake. did not update to latest version for some packages. with latest version (@microsoft packages, angular and typescript) I can build the solutions with angular framework, thank you waldek

Fabske411 avatar Mar 19 '18 10:03 Fabske411

Great to hear it's working @Fabske411! 👍

waldekmastykarz avatar Mar 19 '18 20:03 waldekmastykarz

@Fabske411 @waldekmastykarz Can you please suggest me how exactly did you fix this issue, as I see the same issue. I am trying to run the angular-to-do webpart sample. I am sorry, I might be missing something very basic as am fairly new to SPFx.

running a "npm list --depth 0" gives me the following versions. Are these correct, or do I need to add/update nay specific versions?

[email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- [email protected] -- [email protected] extraneous

npm ERR! extraneous: [email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\node_modules\typescript `

singhdeven avatar Apr 01 '18 17:04 singhdeven

Update the sp packages to 1.4.1

On Sun, Apr 1, 2018 at 7:35 PM +0200, "singhdeven" [email protected] wrote:

@Fabske411

@waldekmastykarz Can you please suggest me how exactly did you fix this issue, as I see the same issue. I am trying to run the angular-to-do webpart sample. I am sorry, I might be missing something very basic as am fairly new to SPFx. running a "npm list --depth 0" gives me the following versions. Are these correct, or do I need to add/update nay specific versions? [email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @microsoft/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- @types/[email protected] +-- [email protected] [email protected] extraneous npm ERR! extraneous: [email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\node_modules\typescript ` — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/SharePoint/sp-dev-docs","title":"SharePoint/sp-dev-docs","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/SharePoint/sp-dev-docs"}},"updates":{"snippets":[{"icon":"PERSON","message":"@singhdeven in #1486: @Fabske411 @waldekmastykarz Can you please suggest me how exactly did you fix this issue, as I see the same issue. I am trying to run the angular-to-do webpart sample.\r\nI am sorry, I might be missing something very basic as am fairly new to SPFx. \r\n\r\nrunning a "npm list --depth 0" gives me the following versions. Are these correct, or do I need to add/update nay specific versions?\r\n\r\[email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\r\n+-- @microsoft/[email protected]\r\n+-- @microsoft/[email protected]\r\n+-- @microsoft/[email protected]\r\n+-- @microsoft/[email protected]\r\n+-- @microsoft/[email protected]\r\n+-- @microsoft/[email protected]\r\n+-- @types/[email protected]\r\n+-- @types/[email protected]\r\n+-- @types/[email protected]\r\n+-- @types/[email protected]\r\n+-- [email protected]\r\n-- [email protected] extraneous\r\n\r\nnpm ERR! extraneous: [email protected] D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\node_modules\typescript\r\n`"}],"action":{"name":"View Issue","url":"https://github.com/SharePoint/sp-dev-docs/issues/1486#issuecomment-377803083"}}}

-------------------------------------------------------     >>> business. people. technology. <<<-------------------------------------------------------adesso AG mit Sitz in DortmundVorstand: Michael Kenfenheuer (Vors.), Christoph Junge, Andreas PrenneisVorsitzender des Aufsichtsrates: Prof. Dr. Volker GruhnAmtsgericht Dortmund HRB 20663

Fabske411 avatar Apr 01 '18 17:04 Fabske411

@Fabske411 - I have tried updating the sp packages by updating the package.son with the following "dependencies": { "@microsoft/sp-client-base": "~1.4.0", "@microsoft/sp-core-library": "~1.4.0", "@microsoft/sp-webpart-base": "~1.4.0", "@types/webpack-env": ">=1.12.1 <1.14.0" }, "devDependencies": { "@microsoft/sp-build-web": "~1.4.0", "@microsoft/sp-module-interfaces": "~1.4.0", "@microsoft/sp-webpart-workbench": "~1.4.0", "@types/angular": "^1.6.9", "@types/chai": ">=3.4.34 <3.6.0", "@types/mocha": ">=2.2.33 <2.6.0", "gulp": "~3.9.1" },

And then tried running "npm install" however it now gives me the following errors: `npm ERR! Windows_NT 10.0.16299 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! node v6.11.5 npm ERR! npm v3.10.10 npm ERR! code ETARGET

npm ERR! notarget No compatible version found: @microsoft/sp-client-base@~1.4.0 npm ERR! notarget Valid install targets: npm ERR! notarget 1.0.0, 0.7.0, 0.5.1, 0.4.0, 0.3.0, 0.2.1, 0.2.0, 0.1.12 npm ERR! notarget npm ERR! notarget This is most likely not a problem with npm itself. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'angular-todo' npm ERR! notarget

npm ERR! Please include the following file with any support request: npm ERR! D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\npm-debug.log`

I hope am in the right direction, please suggest?

singhdeven avatar Apr 01 '18 19:04 singhdeven

Try npm update @latest for sp packages. What does npm outdated show?

On Sun, Apr 1, 2018 at 9:06 PM +0200, "singhdeven" [email protected] wrote:

@Fabske411 - I have tried updating the sp packages by updating the package.son with the following "dependencies": { "@microsoft/sp-client-base": "~1.4.0", "@microsoft/sp-core-library": "~1.4.0", "@microsoft/sp-webpart-base": "~1.4.0", "@types/webpack-env": ">=1.12.1 <1.14.0" }, "devDependencies": { "@microsoft/sp-build-web": "~1.4.0", "@microsoft/sp-module-interfaces": "~1.4.0", "@microsoft/sp-webpart-workbench": "~1.4.0", "@types/angular": "^1.6.9", "@types/chai": ">=3.4.34 <3.6.0", "@types/mocha": ">=2.2.33 <2.6.0", "gulp": "~3.9.1" }, And then tried running "npm install" however it now gives me the following errors: npm ERR! Windows_NT 10.0.16299 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! node v6.11.5 npm ERR! npm v3.10.10 npm ERR! code ETARGET npm ERR! notarget No compatible version found: @~1.4.0 npm ERR! notarget Valid install targets: npm ERR! notarget 1.0.0, 0.7.0, 0.5.1, 0.4.0, 0.3.0, 0.2.1, 0.2.0, 0.1.12 npm ERR! notarget npm ERR! notarget This is most likely not a problem with npm itself. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'angular-todo' npm ERR! notarget npm ERR! Please include the following file with any support request: npm ERR! D:\spfx\sp-dev-fx-webparts-master\samples\angular-todo\npm-debug.log I hope am in the right direction, please suggest? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/SharePoint/sp-dev-docs","title":"SharePoint/sp-dev-docs","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/SharePoint/sp-dev-docs"}},"updates":{"snippets":[{"icon":"PERSON","message":"@singhdeven in #1486: @Fabske411 - I have tried updating the sp packages by updating the package.son with the following\r\n \"dependencies\": {\r\n \"@microsoft/sp-client-base\": \"~1.4.0\",\r\n \"@microsoft/sp-core-library\": \"~1.4.0\",\r\n \"@microsoft/sp-webpart-base\": \"~1.4.0\",\r\n \"@types/webpack-env\": \"\u003e=1.12.1 \u003c1.14.0\"\r\n },\r\n \"devDependencies\": {\r\n \"@microsoft/sp-build-web\": \"~1.4.0\",\r\n \"@microsoft/sp-module-interfaces\": \"~1.4.0\",\r\n \"@microsoft/sp-webpart-workbench\": \"~1.4.0\",\r\n \"@types/angular\": \"^1.6.9\",\r\n \"@types/chai\": \"\u003e=3.4.34 \u003c3.6.0\",\r\n \"@types/mocha\": \"\u003e=2.2.33 \u003c2.6.0\",\r\n \"gulp\": \"~3.9.1\"\r\n },\r\n\r\nAnd then tried running "npm install" however it now gives me the following errors:\r\nnpm ERR! Windows_NT 10.0.16299\r\nnpm ERR! argv \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\" \"install\"\r\nnpm ERR! node v6.11.5\r\nnpm ERR! npm v3.10.10\r\nnpm ERR! code ETARGET\r\n\r\nnpm ERR! notarget No compatible version found: @microsoft/sp-client-base@~1.4.0\r\nnpm ERR! notarget Valid install targets:\r\nnpm ERR! notarget 1.0.0, 0.7.0, 0.5.1, 0.4.0, 0.3.0, 0.2.1, 0.2.0, 0.1.12\r\nnpm ERR! notarget\r\nnpm ERR! notarget This is most likely not a problem with npm itself.\r\nnpm ERR! notarget In most cases you or one of your dependencies are requesting\r\nnpm ERR! notarget a package version that doesn't exist.\r\nnpm ERR! notarget\r\nnpm ERR! notarget It was specified as a dependency of 'angular-todo'\r\nnpm ERR! notarget\r\n\r\nnpm ERR! Please include the following file with any support request:\r\nnpm ERR! D:\\spfx\\sp-dev-fx-webparts-master\\samples\\angular-todo\\npm-debug.log\r\n\r\nI hope am in the right direction, please suggest?"}],"action":{"name":"View Issue","url":"https://github.com/SharePoint/sp-dev-docs/issues/1486#issuecomment-377809078"}}}

-------------------------------------------------------     >>> business. people. technology. <<<-------------------------------------------------------adesso AG mit Sitz in DortmundVorstand: Michael Kenfenheuer (Vors.), Christoph Junge, Andreas PrenneisVorsitzender des Aufsichtsrates: Prof. Dr. Volker GruhnAmtsgericht Dortmund HRB 20663

Fabske411 avatar Apr 01 '18 19:04 Fabske411

@Fabske411 @waldekmastykarz - I ran the npm update @latest command without any errors and then executed npm outdated. See below results.

image

Still getting the same errors:

image

singhdeven avatar Apr 02 '18 18:04 singhdeven

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

msft-github-bot avatar Jan 28 '20 06:01 msft-github-bot