atom-typescript: set experimentalDecorators option

2019-04-30 19:39发布

问题:

I have begun using the Atom editor with the atom-typescript package on an existing project, and I am encountering this warning.

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

I cannot seem to figure out how to do this. I tried adding "experimentalDecorators": true to the compilerOptions in ~/.atom/packages/atom-typescript/lib/tsconfig.json but this did not help. What can I do to get rid of the warning?

回答1:

In order to configure a particular project's TypeScript compiler settings, you need to create a tsconfig.json in the root directory of that project, like so:

{
    "compilerOptions": {
        "experimentalDecorators": true
    }
}

tsc and your editor plugin will both pick this up automatically, and the warning should disappear.