Explore advanced TypeScript configuration options with these 30 multiple-choice questions. Dive into tsconfig.json settings, customizing the build process, and working with declaration files and d.ts for robust TypeScript projects.
strict in a tsconfig.json file?noImplicitAny option in tsconfig.json control?any type for variablesany is usedtsconfig.json option specifies the target JavaScript version for compilation?targetmoduleoutDirlibtsconfig.json, which option allows you to specify the root directory for your TypeScript files?rootDirbaseUrlincludefilesskipLibCheck option in the tsconfig.json file do?.d.ts)moduleResolution in tsconfig.json?nodeclassicesnextnonetsconfig.json?"sourceMap": true"sourceMap": "true""generateSourceMaps": true"sourceMapping": truetsconfig.json controls whether to output the compiled JavaScript to a different directory?outDirrootDirdestinationDiroutputDirtsconfig.json, what does setting "esModuleInterop": true do?tsconfig.json?"noEmit": true"emit": false"generate": false"noCompile": true--outFile compiler optionoutDir setting in tsconfig.jsonoutputFile in tsconfig.json--output flag in the TypeScript command--watch--auto--watchFiles--autoCompiledeclaration option in tsconfig.json do?.d.ts) for TypeScript filestsconfig.json allows for incremental compilation?"incremental": true"cache": true"fastCompilation": true"optimized": true.tsbuildinfo files?"cleanUp": true"removeBuildInfo": true"tsBuildInfo": false"deleteOldBuildInfo": trueexclude field in tsconfig.json control?declaration generation--module--target--moduleResolution--moduleSystem"strict": true"strictMode": true"strictChecks": true"strictErrors": trueremoveComments option to true in tsconfig.json?tsconfig.json?rootDirs optionrootDir optionsbaseDirs optioninclude field with multiple directories.d.ts) in TypeScript?.d.ts file in a TypeScript project?/// <reference path="file.d.ts" /> directiveimport statementinclude array in tsconfig.json.d.ts files when using JavaScript libraries in TypeScript?any.d.ts file?declare var globalVar: string;export var globalVar: string;global var globalVar: string;declare global { var globalVar: string; }declare module 'module-name' { export type myType; }declare module 'module-name' { export default myType; }module 'module-name' { export type myType; }export module 'module-name' { type myType; }.d.ts file?declare function myFunction(): void;export function myFunction(): void;declare myFunction(): void;function declare myFunction(): void;declare interface MyInterface {}interface MyInterface {}export interface MyInterface {}declare type MyInterface = {};declare in a .d.ts file to define an external module?declare module keyworddeclare is only used for variablestsconfig.jsonexport keyword do?.d.ts file in TypeScript?import './file.d.ts';import { typeName } from './file.d.ts';/// <reference path="file.d.ts" />import 'file.d.ts';| Qno | Answer |
|---|---|
| 1 | B) false |
| 2 | A) Ensures that variables must have a type assigned |
| 3 | A) target |
| 4 | A) rootDir |
| 5 | A) Skips checking the types of declaration files (.d.ts) |
| 6 | B) classic |
| 7 | A) "sourceMap": true |
| 8 | A) outDir |
| 9 | A) Allows default import of CommonJS modules |
| 10 | A) "noEmit": true |
| 11 | A) Use the --outFile compiler option |
| 12 | A) --watch |
| 13 | A) Generates declaration files (.d.ts) for TypeScript files |
| 14 | A) "incremental": true |
| 15 | A) "cleanUp": true |
| 16 | A) Files to exclude from compilation |
| 17 | A) --module |
| 18 | A) "strict": true |
| 19 | A) Removes comments from the output JavaScript files |
| 20 | A) Use the rootDirs option |
| 21 | A) To provide type information for JavaScript libraries |
| 22 | D) Both A and C |
| 23 | B) TypeScript will treat the libraries as any |
| 24 | A) declare var globalVar: string; |
| 25 | A) declare module 'module-name' { export type myType; } |
| 26 | A) declare function myFunction(): void; |
| 27 | A) declare interface MyInterface {} |
| 28 | A) Yes, with the declare module keyword |
| 29 | A) Makes the declared type or function available for import |
| 30 | C) /// <reference path="file.d.ts" /> |