[SOLVED] In general, static languages are type checked at compile time. Is typescript also type checked at compile time?

Issue

We create a TS file in vscode and report an error to us after deliberately writing a wrong type. Is the type checked at this time? We haven’t done anything yet.

So when did typescript start type checking´╝č

Solution

Is TypeScript also type checked at compile time?

Yes. In fact, other than a very small aspect related to enums, TypeScript doesn’t exist at runtime at all. TypeScript compiles to JavaScript, which is a dynamically-typed language.

We haven’t done anything yet. … So when did typescript start type checking´╝č

VSCode, like many IDEs, will run TypeScript under the covers as you’re working to type-check the code and report issues, which the IDE then reports to you. The IDEs run TypeScript in "no emit" mode (it doesn’t produce its usual JavaScript output) so it’s just doing syntax checking (because it has to to do its job) and type checking (its primary job).

Answered By – T.J. Crowder

Answer Checked By – Gilberto Lyons (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *