How can I exclude typescript files from being transpiled but still ensure that they work properly with the linter in the Atom editor?
I'm getting this error in my *.spec.ts
files:
An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your
--lib
option.
The problem occurs because I'm explicitly excluding the directory with all of my test files (see the tsconfig file below), because I don't want these files to be transpiled to JavaScript when I build the project. However, I do want these files to be properly linted by the tslint plugin while I'm viewing them in the Atom editor.
My setup:
- Atom.io 1.30 with plugins:
- atom-typescript 12.6.3
- language-typescript 0.4.0
- linter-tslint 1.9.1
- tslint 5.9.1
- typescript 3.0.1
My tsconfig.json
file:
{
"compileOnSave": false,
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"baseUrl": ".",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"inlineSources": true,
"lib": [
"es2017",
"dom"
],
"moduleResolution": "node",
"newLine": "lf",
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./dist",
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"./spec",
"./dist"
]
}