News for hackers. Stuff that matters.
Re:Why We Chose Typescript by octref on Saturday July 01, 2017 @06:22AM (#14676400)
Sorry but what is the use case for Babel + TS? I thought you use either Babel or TS but not both together.
Re:Why We Chose Typescript by a_humean on Saturday July 01, 2017 @08:17AM (#14676776)
You can use Babel with TS. For example, for JSX you can tell TS to "preserve" the JSX, which means you can tell babel or some other compiler take care of that transformation[1]. You can also use babel with typescript to use the babel presets for stage-[0-4] plugins. You can use the webpack TS loader, awesome-typescript-loader, to work with babel[2].

[1] https://www.typescriptlang.org/docs/handbook/jsx.html [2] https://github.com/s-panferov/awesome-typescript-loader

Re:Why We Chose Typescript by mercer on Saturday July 01, 2017 @09:06AM (#14676946)
One case I ran into: using css-loader/style-loader for my css. TS doesn't understand importing css files, so that's where Babel comes in.

In the end i decided to stick to 'old-fashioned' SCSS with an npm script; the downsides of adding Babel to my stack weren't worth the upsides of css modules. Difficult decision to make though.

I guess what I'm saying is that while there is a use case, so far it's been worth it to just stick to TS without Babel, much as I wish it'd be different.

Re:Why We Chose Typescript by ksjogo on Monday July 03, 2017 @08:24AM (#14687729)
You could use the webpack (which you might be using already) css loader and declare the css file as any.
Re:Why We Chose Typescript by pygy_ on Saturday July 01, 2017 @08:15AM (#14676773)
Babel can now parse TypeScript source and turn it into an AST. It doesn't check types at this point.