JSDoc can get you pretty far, but it can be clumsy sometimes. There’s a [TC39 proposal]( https://github.com/tc39/proposal-type-annotations ) to allow types to live in JS code and be treated as comments (similar with Python types today)
TypeScript Without Transpilation (2021)
11–20 of 46 posts
Re: TypeScript Without Transpilation (2021)
#12JSDoc can get you pretty far, but it can be clumsy sometimes. There’s a [TC39 proposal]( https://github.com/tc39/proposal-type-annotations ) to allow types to live in JS code and be treated as comments (similar with Python types today)
Could that improve execution performance?
Re: TypeScript Without Transpilation (2021)
#13Re: TypeScript Without Transpilation (2021)
#14Typically you would do jsconfig.json though, which is same as tsconfig.json but allowJs is already set. Mostly stylistic change, but some tooling might benefit for having jsconfig instead of tsconfig.
Re: TypeScript Without Transpilation (2021)
#15JSDoc can get you pretty far, but it can be clumsy sometimes. There’s a [TC39 proposal]( https://github.com/tc39/proposal-type-annotations ) to allow types to live in JS code and be treated as comments (similar with Python types today)
Could that improve execution performance?
> This proposal aims to enable developers to add type annotations to their JavaScript code, allowing those annotations to be checked by a type checker that is external to JavaScript. At runtime, a JavaScript engine ignores them, treating the types as comments.
The problem is handling errors. If the engine does a full analysis of every code path to ensure the types aren't violated, there's a startup penalty - this includes every time a dynamic import is used, which could interfere with the user as they interact with the page. I'm not entirely sure that such an analysis would be entirely possible- there are many ways to add layers of indirection to JavaScript code.
If the engine doesn't do a full analysis up front but instead checks every time a type is used, you end up with, at best, roughly the same performance characteristics that current JIT engines already have.
Re: TypeScript Without Transpilation (2021)
#16Re: TypeScript Without Transpilation (2021)
#17Re: TypeScript Without Transpilation (2021)
#18JSDoc can get you pretty far, but it can be clumsy sometimes. There’s a [TC39 proposal]( https://github.com/tc39/proposal-type-annotations ) to allow types to live in JS code and be treated as comments (similar with Python types today)
Could that improve execution performance?
Re: TypeScript Without Transpilation (2021)
#19Confused about the mentions of Elm. What does this have to do with Elm?
Re: TypeScript Without Transpilation (2021)
#20Confused about the mentions of Elm. What does this have to do with Elm?