I am starting a new react redux project and was thinking about using typescript again. The last version I tried was 1.6 but typescript has really evolved since then.
I made a smal PoC and I like the idea of static typings in javascript but it really bugs me that I have to deal with missing or broken type definitions all the time. The latest example was a broken type definition in material-ui. It feels like I have to fight the compiler rather than it helps me.
So my idea was to use es6 with babel und add typescript in an optional manner like flow. I read that typescript 2.3 is able to achieve this with the @ts-check comment on top.
So how does this work together? Do I need some babel plugin to get rid of the type definitions in my .js files or do I have to use the .ts .tsx extension?
Or is this complete nonsense and I have to go "full typescript" mode and have to get used to it?
I am a bit lost to be honest.
Update
Babel will be supporting typescript with the next version 7.0. A beta version is already out to test it. As far as I understand it right you are now able to use babel as transpiler and add the babel-preset-typescript. Then you can use typescript in watch mode or only use the VS Code error reporting. I think this will be my favorite stack in the near future.
create-react-app-typescript
and don't have to worry about upgrading my TS build myself. For type inconsistencies I usually either hack/patch the.d.ts
file myself or else cast toany
if I can't figure it out. I strongly suspect that maintaining a hybrid build would be a real time sink.... – mikebridge Sep 11 '17 at 21:09