HenrikJoreteg / hjs-webpack

Helpers/presets for setting up webpack with hotloading react and ES6(2015) using Babel.
1.79k stars 129 forks source link

Typescript ignoring types #325

Closed joshhornby closed 7 years ago

joshhornby commented 7 years ago

I have upload an example what highlights this issue, I am passing a string into this component but the interface shows a boolean (https://github.com/joshhornby/hjs-webpack-ts/blob/master/src/Test.tsx#L4) This should throw a error, but instead this gets rendered. As if the types are being ignored.

I am trying to render both TS and JSX (Babel)

Am I missing a setting in my tsconfig?

Repo: https://github.com/joshhornby/hjs-webpack-ts

selbekk commented 7 years ago

I don't have any experience with typescript myself, so I'm just guessing. But our setup of the awesome-typescript-loader only accepts .ts and tsx files. Could it be that because your app.js file doesn't have that extension, it's not loaded through the compiler and therefore isn't type checked?

TLDR - try renaming app.js to app.ts, update your webpack.config.js accordingly.

Please let me know if this helps at all.

selbekk commented 7 years ago

Closing the issue for now - let me know if you need further assistance.