Recall & Review
beginner
What is the first step when migrating a JavaScript project to TypeScript?
Rename your JavaScript files from
.js to .ts to enable TypeScript features and start getting type checking.Click to reveal answer
beginner
Why add type annotations during migration?
Type annotations help catch errors early by telling TypeScript what kind of values variables and functions expect, making your code safer and easier to understand.
Click to reveal answer
intermediate
What is the role of the
tsconfig.json file in a TypeScript project?It configures the TypeScript compiler options, like which files to include, target JavaScript version, and strictness rules, guiding how TypeScript checks and compiles your code.
Click to reveal answer
intermediate
How can you gradually migrate a large JavaScript codebase to TypeScript?
Use the
allowJs option in tsconfig.json to include JavaScript files, then convert files one by one, adding types step-by-step to avoid big disruptions.Click to reveal answer
beginner
What is the
any type and when should you use it during migration?The
any type disables type checking for a variable. Use it temporarily when you don't know the exact type yet, but plan to replace it with specific types later.Click to reveal answer
What file extension should you use for TypeScript files?
✗ Incorrect
TypeScript files use the
.ts extension. .tsx is for TypeScript with JSX.Which
tsconfig.json option allows JavaScript files to be included in a TypeScript project?✗ Incorrect
The
allowJs option lets the compiler process JavaScript files.What does the
any type do in TypeScript?✗ Incorrect
any tells TypeScript to skip type checking for that variable.Why is it good to add type annotations gradually during migration?
✗ Incorrect
Gradual typing helps keep the project working while improving safety step-by-step.
What is the purpose of
tsconfig.json?✗ Incorrect
tsconfig.json tells the compiler how to process your TypeScript code.Explain the main steps to migrate a JavaScript project to TypeScript.
Think about file changes, configuration, and adding types step-by-step.
You got /5 concepts.
Describe how the
any type helps during migration and why it should be used carefully.Consider both benefits and risks of using <code>any</code>.
You got /5 concepts.