Could we have TypeScript with no build step? Could we have types in JavaScript? Maybe! We're exploring bringing optional type syntax into the JavaScript language! devblogs.microsoft.com/typescript/a-p…
The Types as Comments proposal means that browsers could run TypeScript-checked code directly, (even though they wouldn't do any type-checking). That means faster iteration with all the type-checking and editing experience you know and love today.
@typescript seems really similar to the type checking in Closure compiler which was my favorite way to write js! ++ for this
@typescript I am clairvoyant 🔮 (CRA-ZY)
@typescript This proposal looks like an amazing opportunity to effectively deprecate runtime constructs that should never have been in TypeScript in the first place, such as Enums and class visibility modifiers. No breaking changes needed since this is opt-in!
@typescript JSDoc typings already cover this use case 🤦🏼♂️ Including type checking, typings (ie .d.ts) generation And in VSCode: inline type checking, intellisense, and inline documentation I've been using build-less TS typed JS for years
@typescript Hmmm don’t really like this. The JavaScript parser still has to understand the types in some form in order to know what to ignore? What will you see in the Developer tools, will the types be shown there? Any minifier is going to strip these types anyway for a good reason.
@typescript Would specing that browsers read `application/typescript` files in a type-ignoring manner solve the same issues, and be simpler by leaving the JS language untouched/avoiding TC39?
@typescript Except that's not what this proposal is. Why then are you marketing it as "TS with no build step"?
@typescript Getting the actual typescript runtime in the browser, running typescript truly as-is with no transpilation step, would be ideal. And it would be feasible, given how eager browsers are to update. Your very own colleagues manage one of those browsers already!
@typescript Good god just use JavaScript and a better linter.
@typescript I admire everyone's efforts here, but it's very troubling to be throwing away JS's ability to ever use type information at runtime, because the syntax space was taken up by everyone's pet type checker and we Don't Break The Web. It's going to be a fun ride...
@typescript This seems nice, but IMHO should get rid of some legacy syntax before 🙂
@typescript How about a fast compiler that’s not written in JavaScript first? How would the type checking be faster if it still uses tsc under the hood. Tools like @vite_js already give us instant updates and type checks running concurrently. I would also love a TypeScript package registry!
@typescript This is a great idea. I've been hoping for something like this for a long time. It reminds me of the transition from ActionScript2 to ActionScript3 (also based on the ECMAScript standard). In AS3, types were optional but the code was interpreted at runtime (no transpilation).
@typescript Wouldn't it be much better to instead allow for using other languages in the browser and defining sdk's for them? Something like wasm but more practical. This is more like copying typescript features into javascript
@typescript Please please please let this proposal reach Stage 1!
@typescript apropos of nothing (except positive possibilities for the language), how about support for tail call recursion in browsers?
@typescript This is a wonderful stop gap proposal to real types, but ultimately I want full static typing in js for performance and to eliminate the need for using a separate language to do #webassembly
@typescript I really like the idea of : as a "smart" comment syntax that's aware of commas and braces. 🔥 Not a big fan of adding `type` and `as` as new (contextual) keywords that also act like comments, though. That feels redundant, and I'd rather have TS adopt Flow cast syntax in JS mode
@typescript Instead of complaining here just read the proposal on GitHub properly. There are so many claims that are not true and those who have not used TS and never will have nothing to say here. Sorry if I have to express it so hard.
@typescript But, that would mean that you can't add features to TypeScript unless you add it to the JavaScript specs and wait for engines to support it, right?
@typescript For a type system, but comments are for humans. Have another iteration for a proper extension of the ECMAScript syntax, take inspiration from other modern languages such as Rust, Dart, Swift, as well TypeScript. I really think it could be great, but not with comment hacks! :)
@typescript It feels wrong. You make a dynamic language static. The whole Idea feels stupid. Microsoft wants this, why? To push the backend stuff to the client?
@typescript Aren't we going backwards? How can it be better?
@typescript I use jsDoc for optional typing in js since quite a while, see for example webengineering-fhnw.github.io/Kolibri/
@typescript Frankly, what's the point of this? We already have ts-node, and on the backend, especially when unit testing - it makes sense. But what do you need this for on the frontend where you already have a mandatory deployment step anyway?
@typescript in my opinion, Typescript does great, but looks ugly sometimes and almost unreadable, but over all, it is great