-
-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript 3.7 Support #903
Comments
It does, but it is set to 3.6.4 still. Needs to be updated and then good to go I think? |
TypeScript 3.7 is already supported, you would need to update your local installation. |
@blakeembrey It's not supported though. As OP mentions, you'll see errors on optional chaining and nullish coalescing expressions when running ts-node, even though your local typescript version is set to 3.7.2. |
One of the errors I'm getting:
Tried a clean install with |
I noticed the fix is to change |
By that error it is compiling correctly. The error is a node.js runtime error, not TypeScript compilation. As noted it’s failing because you’re compiling an output that node.js doesn’t understand yet. |
Ohhhh yup. It seems to be a target issue. Thanks @keesvanlierop 😄 |
Is there any way to have nullish coalescing work on target |
@iwasaki-kenta my solution was to set target to es2018 and then: "lib": [
"es2018",
"esnext.bigint"
] So I have 2018 stuff, but I still support BigInt. It will only work expressed as |
OMG I had this same problem with a rollup / Vue / TypeScript combination. |
Also |
For me |
I faced the same issue but the solution depends of the NodeJS version that runs the script. |
I can also confirm that setting my |
this is going backwards it is werid. |
Remember that TypeScript is compiling your code from If you set Make sure you know the answers to these question. Otherwise, you're likely to confuse yourself and be unsure whether a problem is caused by your configuration or by |
nullish coalescing and optional chaining are supported in node >= v14.0.0 |
Just to make things a bit easier for new players, remember that "The target setting changes which JS features are downleveled", that is if the feature isn't natively supported by the NodeJS runtime version the TS compiler generates different code that will run on the node version. That's why |
Also "target": "es2019" works for me but "target": "es2020" not yet. |
I think |
as discussed in TypeStrong#903. I had to search for awhile to find that issue and figure out what was going on, and there were some duplicate issues, so I think it would help people to explain this directly in the README.
why config to |
I have TypeScript 3.7 installed on a project, and I run tests with ava and ts-node. The issue I found is that compilation works as expected, but tests fail because ts-node doesn't recognize the syntax for nullish coalescence and optional chaining.
So if I have:
I get errors all over the place. Isn't
ts-node
using the local typescript package to do compilation?The text was updated successfully, but these errors were encountered: