-
-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: What is TypeScript Node? #1208
Comments
Before I answer, what is your experience level with TypeScript? Do you know how TypeScript is typically compiled and executed without |
Hi @cspotcode - I'm not an expert in TypeScript, however when I run I'm trying to wrap my head around what TypeScript Node does as it seems to offer a runtime without a build step. Is it somehow transpiling (building) TS to JS under the hood during execution and somehow storing the result in memory (since it's not stored in the file system)? The documentation seems to imply there is not a build step (which I've also noticed when running Please do correct my language if I'm saying something wrong. |
I'm mainly wondering is there some kind of build happening at runtime? Is that happening up front, during execution and where is the resulting JS. Or does it somehow compile directly to machine code (C++)... not even sure if that's possible. I feel like I'm missing something that I'm not finding in the docs or any articles / Google searches. Starting to question my knowledge since I'm clearly in the minority :D |
Correct, we execute the compiler in-memory, to do 2x tasks: a) semantic analysis / typechecking. These are the errors that We also install
|
Great answer - thank you so much @cspotcode. This clearly spells it out for me. Maybe I could somehow put this answer in a PR that adds to the README (someday) |
Happy to help. For what it's worth, I'm hoping to make a proper website for ts-node, to make documentation a bit friendlier and more discoverable. I'm working on that over here: #1207 |
Desired Behavior
It would be great if the project would answer some fundamental questions in the documentation. In doing a variety of Google searches and parsing through issues, it's difficult to understand what exactly TypeScript Node does and how reliable it is. Below are some basic questions I think should be answered at the top of the documentation.
TypeScript execution and REPL for node.js, with source map support.
. I get it - it's an executor. But, if that's true - how or why is it transpiling (noticed the--transpile-only
flag). If it is an executor, then why is there mention of compiling - noted in theHow It Works
section:TypeScript Node works by registering the TypeScript compiler for .ts, .tsx, .js, and .jsx extensions.
. Does this mean compiling to C++ via just-in-time compilation to machine code the moment a piece of code is executed?Is this request related to a problem?
No
Additional context
I'm doing some research about potentially using TypeScript Node with a large scale website and I need to make sure it is a reliable option that doesn't sacrifice performance. I'm having difficulty getting clear answers to those questions.
The text was updated successfully, but these errors were encountered: