Angular-cli: experimentalDecorators is rendered ineffective with the merge of webpack branch into master

Created on 30 Jul 2016  路  11Comments  路  Source: angular/angular-cli

  1. Mac OSX (El Capitan?)
  2. angular-cli: local (v1.0.0-beta.10, branch: master) # webpack branch merged into master
    node: 5.11.1
    os: darwin x64
  3. ng new foobar --skip-npm --link-cli
  4. open foobar in visual code and in app.compoent.ts you'll see: [ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. class AppComponent
  5. removing lib, typeRoots and types from tsconfig.json made the warning go away.
  6. Visual Studio Code version 1.3.1
RFC / discussion / question bufix

Most helpful comment

vscode uses an internal copy of typescript which is currently at version 1.8.x. CLI-based projects use typescript 2.0. The project will build fine with the CLI. vscode just doesn't understand the new options.

To make vscode use the project's typescript, add a workspace settings file in vscode and add the following setting: "typescript.tsdk": "./node_modules/typescript/lib". (the path may need to be changed depending on your setup)

All 11 comments

vscode uses an internal copy of typescript which is currently at version 1.8.x. CLI-based projects use typescript 2.0. The project will build fine with the CLI. vscode just doesn't understand the new options.

To make vscode use the project's typescript, add a workspace settings file in vscode and add the following setting: "typescript.tsdk": "./node_modules/typescript/lib". (the path may need to be changed depending on your setup)

@clydin - tried it with no effect. Just wonder when the decorator feature will be coming out of experimental status. Perhaps after release 1.0 of Angular?

@clydin trick works on my environnement

@un33k Since you used the --skip-npm option, you won't have a local install of typescript. You'll either need to manually run npm install or point the setting to the location of your globally installed version (make sure it's 2.0). If you need the global npm install path, run npm root -g.

See answer in https://github.com/Microsoft/vscode/issues/9232#issuecomment-237544038 (basically what @clydin said).

un33K it worked for me with workspace setting:
"typescript.tsdk": "node_modules/typescript/lib"
so no ./ in front of node_modules
and do a ">reload window" in the command panel of visual studio code

Go to File > Preferences > Workspace Settings then add the below to settings.json

// Place your settings in this file to overwrite default and user settings. { "typescript.tsdk": "./node_modules/typescript/lib" }

Then go to View > Command Palette > type "reload window" in panel and press enter.

Above trick works for me.

napster are you a repeat box?

@clydin solution works. Using latest version of TypeScript and Angular 2 final release

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._

Was this page helpful?
0 / 5 - 0 ratings