Typescript support is broken
See original GitHub issueWhat were you expecting to happen?
When I follow the steps outlined in this stack-overflow post, it should allow us to write our gulp files in pure Typescript:
https://stackoverflow.com/a/49849088/1611058
These were steps that used to work back in 2020 but don’t work anymore.
What actually happened?
As sydd’s comment says:
I get
SyntaxError: Cannot use import statement outside a module
if the project’s type is commonjs andTypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
if the project’s type is module
Please give us a sample of your gulpfile
// gulpfile.ts
import gulp from 'gulp'
gulp.task('default', function (done) {
console.log('test');
done()
});
Terminal output / screenshots
Please provide the following information:
- OS & version: Windows 10 - 20H2
- node version (run
node -v
): v12.18.2 - npm version (run
npm -v
): 6.14.5 - gulp version (run
gulp -v
): CLI version: 2.3.0; Local version: 4.0.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
dodgy TypeScript support (missing/broken type inference)
I have several issues with TypeScript support in PhpStorm, but the biggest problem thus far, is that PhpStorm does not perform the level...
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them. ... Broken Code ❌ ... If you want to support multiline text,...
Read more >Promise made and promise broken: TypeScript vs. real life data
That's why the suite is run against a long-ish list of supported TypeScript versions, only then I am reasonably certain that the code...
Read more >Documentation - TypeScript 3.7
Better Support for never -Returning Functions ... This gave us the opportunity to expand support for another class of ... Broken code, do...
Read more >JavaScript and TypeScript in Visual Studio | Microsoft Learn
The option to restore to the legacy JavaScript language service is no longer available. Users have the new JavaScript language service out-of- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, I thought this was commonly known.
I actually think this comment is more likely to be of a benefit in a vite app: https://github.com/TypeStrong/ts-node/issues/922#issuecomment-673155000 (you can override compiler options specifically only for ts-node)
This fixed it! 😃
https://github.com/TypeStrong/ts-node/issues/922#issuecomment-667076602
In tsconfig.json you need the following: