Learn TypeScript

Quiz

Quiz

This quiz will test what you have learned about configuring the TypeScript compiler.

1.

We want the TypeScript compiler to stop generating JavaScript when it finds a type error. What compiler option can we use to do this?

2.

We are setting up a TypeScript project and are outputting transpiled JavaScript to a public folder. We also place the original TypeScript in the public folder for debugging purposes, but this is getting transpiled. How can we stop TypeScript transpiling TypeScript files in the public folder?

3.

We want to be able to debug the TypeScript code in our project. What compiler options can we use to do this?

4.

What compiler option will rerun the compiler when TypeScript code is changed?

5.

What compiler options will disallow null values in types?

6.

What compiler option will raise a type error when it finds a redundant local variable?

7.

The following function is raising a type error on the includes array method:

function reducePrice(code: string, price: number) {
if (discountCodes.includes(code)) {
return price - price * 0.1;
}
return price;
}

How can this be resolved?

© 2023 Carl Rippon
Privacy Policy
This site uses cookies. Click here to find out more