News for hackers. Stuff that matters.
Re:Brython: an implementation of Python 3 running in the bro... by runarberg on Monday July 19, 2021 @11:49PM (#27889866)
You can actually annotate typescript types using JSDoc comments. So if you don’t like the added step of compiling your source down to JavaScript you can still write JavaScript with doc comments and then typecheck with `tsc --noEmit` which won’t run the compile step.

However I do see the appeal of the ergonomic of the TypeScript syntax. I hope TC39 will add something like optional type annotations to the spec.

Re:Brython: an implementation of Python 3 running in the bro... by rpmisms on Tuesday July 20, 2021 @03:12PM (#27897922)
It could be a feature flag, like `use strict`, but `use types` instead
Re:Brython: an implementation of Python 3 running in the bro... by runarberg on Tuesday July 20, 2021 @04:58PM (#27899238)
I’m actually hoping for something more akin to python’s optional type annotations. Where opting in is as simple as using type annotations. The runtimes (i.e browsers, nodejs, etc.) would then simply ignore them like they do with comments. But third party tools could use them to do some static analysis. Like mypy does for python (or tsc --noEmit does for javascript).
Re:Brython: an implementation of Python 3 running in the bro... by rpmisms on Tuesday July 20, 2021 @06:59PM (#27900354)
It really depends on if you want enforced typing, which is why I think a feature flag could be useful. There's room for both—explicit typing being available, and enforced types being a flag away.