TypeScript Version: 3.0.1
Search Terms:
Expiremental Decorator not being recognized in tsconfig
Code
tsconfig
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonJS",
"types": [
"node"
],
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es6",
"dom"
]
},
"exclude": [
"./node_modules"
]
}
Expected behavior:
To recognize experimental decorators
Actual behavior:
Throwing error on all files containing decorators: TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Some background, this issue came out of no where. ~20 hours ago I was able to do a clean npm install and build the project without any issue. This morning, I ran the same command with no change to any packages, tsconfig, or related code and this error started occurring. All of the issues I have found online are only related to the error occurring in VSCode, but that's no help to me because I am using Webstorm.
The fact that it worked last night but not this morning makes me think there's some update to a package (potentially TS) that is causing the issue to occur.
Package.json
{
"name": "React-Node-App",
"version": "1.0.0",
"description": "",
"author": "",
"license": "ISC",
"scripts": {
"clean": "rimraf dist",
"dev:server": "concurrently \"tsc -w -p ./src/server\" \"nodemon --config ./src/server/nodemon.json dist/server/app.js\"",
"test:server": "mocha $NODE_DEBUG_OPTION --opts test/mocha.opts -r ts-node/register ./src/server/**/*.test.ts",
"lint": "ng lint",
"predev": "tsc -p ./src/server",
"dev": "concurrently \"npm run dev-client\" \"npm run dev:server\" ",
"dev:debug": "concurrently \"npm run dev-client\" \"tsc -w -p ./src/server\" \"nodemon --config ./src/srver/nodemon.json --inspect dist/server/app.js\"",
"start": "nodemon dist/server/app.js",
"postinstall": "tsc -p ./src/server",
"install": "npm run build-client",
"build:client": "cd ./src/client && webpack",
"build-client": "cd ./src/client && webpack -p",
"dev-client": "cd ./src/client && webpack-dev-server"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "1.17.2",
"bootstrap": "^4.1.3",
"core-js": "2.4.1",
"cors": "^2.8.4",
"dotenv": "4.0.0",
"email-validator": "^2.0.3",
"eslint": "3.19.0",
"express": "4.15.3",
"font-awesome": "^4.7.0",
"handlebars": "^4.0.11",
"jquery": "^3.3.1",
"jwt-decode": "^2.2.0",
"jwt-simple": "^0.5.1",
"lodash": "^4.17.5",
"moment-timezone": "^0.5.16",
"mongoose": "^5.0.5",
"morgan": "^1.9.0",
"multer": "^1.3.0",
"node-sass-chokidar": "0.0.3",
"passport": "0.3.2",
"passport-anonymous": "^1.0.1",
"passport-jwt": "2.2.1",
"react": "^16.1.1",
"react-bootstrap": "^0.31.5",
"react-burger-menu": "^2.5.2",
"react-day-picker": "^7.1.10",
"react-dom": "^16.1.1",
"react-paginate": "^5.2.4",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
"react-slick": "^0.23.1",
"react-tabs": "^2.2.2",
"react-toastify": "^3.4.3",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
"reflect-metadata": "^0.1.12",
"routing-controllers": "^0.7.6",
"s3-streamlogger": "^1.3.1",
"slick-carousel": "^1.8.1",
"typedi": "^0.6.1",
"underscore": "^1.9.0",
"winston": "^2.4.2"
},
"devDependencies": {
"@types/chai": "^4.0.3",
"@types/mocha": "^2.2.41",
"@types/node": "^6.0.101",
"@types/react": "^16.3.10",
"awesome-typescript-loader": "^3.1.2",
"chai": "^4.1.1",
"concurrently": "3.5.0",
"cross-env": "^4.0.0",
"css-loader": "^0.28.11",
"eslint": "^4.1.1",
"eslint-plugin-react": "^7.1.0",
"file-loader": "^1.1.11",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^11.1.0",
"mocha": "^3.5.0",
"mocha-jsdom": "^1.1.0",
"mocha-junit-reporter": "^1.13.0",
"node-sass": "^4.9.0",
"nodemon": "1.12.7",
"nyc": "^11.5.0",
"protractor": "~5.1.2",
"rimraf": "^2.6.2",
"sass-loader": "^7.0.1",
"style-loader": "^0.21.0",
"ts-loader": "^4.2.0",
"ts-node": "^3.3.0",
"tslint": "~5.3.2",
"typescript": "3.0.1",
"url-loader": "^1.0.1",
"webpack": "^4.6.0",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^2.1.2",
"webpack-dev-server": "^3.1.3"
},
"engines": {
"node": "6.11.2",
"npm": "5.5.1"
},
"nyc": {
"all": true,
"include": [
"src/**/*.js"
],
"cache": true
}
}
You have no include or files in your tsconfig.json, therefore the compiler/editor has no idea which files to apply the configuration to.
@kitsonk Even if I add it it still does not work. It's always worked without that included also. The issue is also completely separate from the IDE. When I push my changes to Heroku that can not build the project either and continuously fails.
Your version of TypeScript is pinned at "3.0.1", so why do you think it was a change to TypeScript and not something else in your build toolchain that caused the issue? The version of TypeScript did not change with a fresh install.
@kitsonk Should have mentioned I was playing around with the package versions to see if it was bumped. It was at ~2.8.3
And reverting to version 2.8.3 or 2.9.2 fixes the issue?
@kitsonk No neither does :/
Yeah, so again, I don't think you are dealing with a TypeScript issue, you are dealing with something else that is fragile in your toolchain.
@kitsonk Strange, yeah I'll keep looking into it and see if I find out what's causing the issue
@kitsonk setting up a sample project with only typescript as a dependency I can easily reproduce the issue.


Most helpful comment
You have no
includeorfilesin yourtsconfig.json, therefore the compiler/editor has no idea which files to apply the configuration to.