typescript errors for (@types/**) @angular/cli rc4
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0-rc.4 node: 6.10.0 os: darwin x64 @angular/common: 2.4.10 @angular/compiler: 2.4.10 @angular/core: 2.4.10 @angular/forms: 2.4.10 @angular/http: 2.4.10 @angular/platform-browser: 2.4.10 @angular/platform-browser-dynamic: 2.4.10 @angular/router: 3.4.10 @angular/cli: 1.0.0-rc.4 @angular/compiler-cli: 2.4.10
Repro steps.
- yarn add @types/lodash --save-dev
- add
import * as _ from 'lodash';to app.component.ts - ng build
The log given by the failure.
ERROR in /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,21): ']' expected.) /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,22): ';' expected.) /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,23): Declaration or statement expected.) /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,33): ']' expected.) /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,34): ')' expected.) /somewhere/project/node_modules/@types/lodash/index.d.ts (11451,35): Declaration or statement expected.) ...
same if you update the supplied @types/jasmine to 2.5.46
ERROR in /somewhere/project/node_modules/@types/jasmine/index.d.ts (40,52): '=' expected.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (42,62): '=' expected.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (40,38): A parameter initializer is only allowed in a function or constructor implementation.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (40,46): Cannot find name 'keyof'.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (42,46): A parameter initializer is only allowed in a function or constructor implementation.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (42,56): Cannot find name 'keyof'.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (58,42): Cannot find name 'Partial'.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (99,22): Cannot find name 'Partial'.) /somewhere/project/node_modules/@types/jasmine/index.d.ts (99,35): Cannot find name 'Partial'.)
Desired functionality.
Mention any other details that might be useful.
downgrade to @types/[email protected] works
Smth broke in Angular-cli when using yarn, I got issues as well https://github.com/angular/angular-cli/issues/5536
Have you tried installing types via npm instead?
Got the same problem with npm
ERROR in ../node_modules/@types/node/index.d.ts (73,13): Subsequent variable declarations must have the same type. Variable 'require' must be of type 'any', but here has type 'NodeRequire'.)
ERROR in /../node_modules/@types/offline-js/index.d.ts (6,13): Subsequent variable declarations must have the same type. Variable 'Offline' must be of type 'any', but here has type '{ options: OfflineOptions; check: () => void; state: string; on(event: "up", handler: (e: Event) ...'.)
@osahner those type definitions require a later version of typescript than 2.0. This is not a CLI issue. You'll need to update to angular 4.0 to update past TS 2.0. Otherwise you'll need to pin the typings to a compatible version.
@Shinzah please open a separate issue and include the contents of the typings.d.ts file if your project contains one.
Closing as answered by @clydin, thank you.
Just updated to rc4 and had the same problem. Pinning the lodash typings to version 4.14.50 solves the problem (thanks @clydin).
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.