Learn TypeScript
Quiz
Quiz
This quiz will test what you have learned about configuring the TypeScript compiler.
We want the TypeScript compiler to stop generating JavaScript when it finds a type error. What compiler option can we use to do this?
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?
We want to be able to debug the TypeScript code in our project. What compiler options can we use to do this?
What compiler option will rerun the compiler when TypeScript code is changed?
What compiler options will disallow null
values in types?
What compiler option will raise a type error when it finds a redundant local variable?
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?