Live data from Hacker News

TypeScript Without Transpilation (2021)

incrementalelm.com

1–10 of 46 posts

Re: TypeScript Without Transpilation (2021)

#3
Sorry for being that guy, but this should probably be called "typechecking without transpilation".

What ends up being written is not TypeScript syntax (which does require transpilation to run).

JSDoc is awesome for incremental adoption though, I've migrated a few codebases this way without too much pain.

Re: TypeScript Without Transpilation (2021)

#6
post #3

Sorry for being that guy, but this should probably be called "typechecking without transpilation". What ends up being written is not TypeScript syntax (which does require transpilation to run). JSDoc is awesome for incremental adoption though, I've migrated a few codebases this way without too much pain.

Is there some command you can run to rewrite all the JSDoc as actual TypeScript?

Re: TypeScript Without Transpilation (2021)

#7
post #6
post #3

Sorry for being that guy, but this should probably be called "typechecking without transpilation". What ends up being written is not TypeScript syntax (which does require transpilation to run). JSDoc is awesome for incremental adoption though, I've migrated a few codebases this way without too much pain.

Is there some command you can run to rewrite all the JSDoc as actual TypeScript?

Programmatically yes: https://github.com/microsoft/TypeScript/blob/28cd1fbd13b8d09...

You just need to call this from somewhere like ts-morph.

Re: TypeScript Without Transpilation (2021)

#8
post #5

Does anyone know if I have a TypeScript project, is there an automated process to turn it into this format this article describes? Eject for TS, I guess.

GPT-4 would probably do a good job at that if the code is not sensitive

Is there some way to load an entire large project into gpt4? Or do you mean to have it translate one file at a time without context?

Re: TypeScript Without Transpilation (2021)

#9
post #3

Sorry for being that guy, but this should probably be called "typechecking without transpilation". What ends up being written is not TypeScript syntax (which does require transpilation to run). JSDoc is awesome for incremental adoption though, I've migrated a few codebases this way without too much pain.

Not TypeScript the language, but TypeScript the typechecker program. “Typescript without transpilation” is still perfectly accurate.
Post reply on HN