3 ms·
I just flipped over my React app to typescript + react, and as a word of warning, support for some React libs is sketchy. For example, typings for redux Thunks
by jorblumesea 9y ago
I just flipped over my React app to typescript + react, and as a word of warning, support for some React libs is sketchy. For example, typings for redux Thunks are wonky/problematic and required a few hacks to fix. Very cool stuff just buyer beware :) You will probably have to work around more than a few issues if you use anything more than vanilla React.
- styfle 9y agoNothing that a little `var unsafe = original as any;` couldn't solve!
- cloverich 9y agoTo be a bit more explanatory: You can cast to the "any" type by adding `as any` to any variable, and it will then work just like Javascript. Typescript will know not to infer types from it or complain about it, and for that variable (which could be a simple variable or an entire library) will work just as it would in regular javascript. I typically use this when testing out a new library that doesn't have Typescript types so I can get a feel for it (and if I like it, I"ll progressively add types to it; its a very nice process imo).