0
0
Typescriptprogramming~5 mins

What survives compilation to JavaScript in Typescript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What happens to TypeScript types after compilation to JavaScript?
TypeScript types are removed during compilation. They do not exist in the JavaScript output because JavaScript does not support static types.
Click to reveal answer
beginner
Do interfaces in TypeScript appear in the compiled JavaScript code?
No, interfaces are only used for type checking during development and are removed during compilation. They do not generate any JavaScript code.
Click to reveal answer
beginner
Which TypeScript features survive compilation to JavaScript?
Features like classes, functions, variables, and control flow statements survive because they have direct JavaScript equivalents.
Click to reveal answer
intermediate
What happens to enums in TypeScript after compilation?
Enums are converted into JavaScript objects with properties representing the enum members, so they survive compilation as usable JavaScript code.
Click to reveal answer
beginner
Why does TypeScript remove type annotations during compilation?
Because JavaScript does not support static typing, type annotations are only for development help and are removed to produce valid JavaScript code.
Click to reveal answer
What happens to TypeScript type annotations after compilation?
AThey are preserved as variables
BThey become JavaScript comments
CThey are removed and do not appear in JavaScript
DThey are converted to runtime type checks
Which of these survives compilation from TypeScript to JavaScript?
AClasses
BType aliases
CInterfaces
DType assertions
How are TypeScript enums represented in compiled JavaScript?
AAs JavaScript objects with properties
BThey are removed completely
CAs strings only
DAs functions
Do TypeScript interfaces generate any JavaScript code?
AYes, as objects
BNo, they are removed
CYes, as functions
DYes, as classes
Why does TypeScript remove type information during compilation?
ATo add comments
BTo reduce file size
CTo improve runtime performance
DBecause JavaScript does not support types
Explain what parts of TypeScript code remain after compilation to JavaScript and why.
Think about what JavaScript can run and what is only for development.
You got /4 concepts.
    Describe how TypeScript enums are transformed in the compiled JavaScript output.
    Consider how enums can be used after compilation.
    You got /3 concepts.