TS is ~10 years old at this point, it seems healthy to start its teenager years with some storming and experimentation.
Let's hope we don't need to wait until its sweet sixteen birthday party for this to land in JS proper š
10/10 š§µ
All in all, I'm very excited! I will be closely monitoring how this proposal is going.
Did you know you can _read the meeting notes on github_? Love the open-source mentality! š
github.com/tc39/notes
9/10 š§µ
Looking into the proposal in more detail: I'm learning new things š!
Did you know that `add<number>(4, 5)` is _valid JS_? It makes sense when you think about it, just never did š¤·āāļø astexplorer.net/#/gist/26322ā¦
8/10 š§µ
Side note: This is another reason why it was super-smart for @ahejlsberg š§ and his team to use the `.ts` extension, instead of .js, which was a popular alternative.
It will now be easy to disallow 'non-core-ts' code, like enums, in .js files.
7/10 š§µ
Not allowing all TS syntax splits the TS world. A "core ts syntax" would be allowed in .js, but not all of it.
It might be smart to already start using that core syntax today to make the eventual migration step easier. For example: choose string unions over enums. š¤
6/10 š§µ
Anything that comes with runtime overhead, like enums, namespaces, and constructor parameters, is deemed out of scope.
This is a good thing: you don't want to go too much off-topic in a big proposal like this. š¤·āāļø
5/10 š§µ
There is also a bunch of new syntax to be added to JS: interfaces, types, generics, import type, ... the list goes on. šµ
Not all of it planned to be added at once.
4/10 š§µ
Reading through it, it is clear that this is not going to be easy. It's mainly hard to decide _where type comments start and where they stop_.
For example: `function foo(bar: baz) {}` seems simple, but what about `function foo<bar>(baz: { qux: corge }) {}`? š¤·āāļø
3/10 š§µ
I'm very happy with the proposal! I've said for years now that I'd eventually see the TS world and the JS world colliding on the file level.
Adding types as comments feels like the best of both worlds: strong validation at CI time and no runtime overhead.
2/10 š§µ
Last week moved some TS code we ran without type checking (using ts-node's transpileOnly) to plain JS where we first type check it (using tsc's --checkJS) š.
Loving #typescript š
Also a shout-out to @JoshuaKGoldberg for adding the "Allowing code in constructor before `super()`". Something that can be frustrating from time to time and now "just works" as excepted. Well done! š