by esamatti · 9y ago · 0 comments
- You don't need ts-loader/at-loader with Webpack anymore. You'll lose typechecking during webpack build but you can run it as separate step. Your editor will show them as usual still.
- You can use all the Babel plugins with Typescript without running two compilers (should speed things up)
- Should add first class support for React Native as it uses Babel (or at least no more 2-step builds)
[1]: http://babeljs.io/blog/2017/09/12/planning-for-7.0#typescrip...
EDIT: For the curious here's my build configuration with Webpack demoing this with extra plugins https://gist.github.com/epeli/bb8ae386f9dbb2a4ae2159e1f265fd...
If you also want to use it as an enforcer, you set it up as a pre-commit hook or a CI step or whatever you want.
The idea is not to be forced to typecheck on every little incremental build during development. Sometimes I _know_ what needs to be done to get typechecking to pass (I can see the type errors highlighted in my editor after all) but I don't want to have to fix it before running my code to see how it behaves, because maybe I'm just playing around with an idea.
There are pros and cons to typechecking and not typechecking, which is why both kinds of language exist. Annotation- stripping lets you get the best of both worlds.
Tried this on a project of mine. Enums seem to work fine for me.
EDIT: There are some issues with enums indeed https://github.com/babel/babel/tree/master/packages/babel-pl...
Because he thinks you can't do JS development without Babel.
(I haven't used TypeScript yet, so I might be wrong)
The error log shows me the rest of the files that need fixing.
How would you get that with Babel?
But you could just run "tsc --noEmit --watch" which will just report the project wide type errors to the console as you edit files.
(I work on Babel)