Questions
TypeScript questions
Choose a question page, learn the concept, then test your understanding with a quiz.
TypeScript: Ignore node_modules Errors with skipLibCheck and lib
Learn why TypeScript checks node_modules declarations and fix missing Map, Set, and Symbol errors using lib, types, and skipLibCheck.
TypeScript: Why a Property Does Not Exist on Type 'never'
Learn why TypeScript narrows a variable to never after a closure mutation and how return values and control-flow analysis solve it.
Typing React onChange Event.target.value in TypeScript
Learn how to correctly type React input onChange events in TypeScript without using any, including event types and reusable props.
Typing React useState with TypeScript
Learn how to type React useState with TypeScript, including object state, nullable values, inferred types, and correctly typed setter functions.
Understanding "JSX element type does not have any construct or call signatures" in React and TypeScript
Learn why this React TypeScript JSX error happens and how to type component props correctly with practical examples and fixes.
Understanding "not assignable to parameter of type never" in TypeScript
Learn why TypeScript infers `never[]` for empty arrays and how to fix the "not assignable to parameter of type never" error.
Understanding .d.ts Declaration Files in TypeScript
Learn what .d.ts files do in TypeScript, how they relate to .ts and .js files, and when you can use declaration files instead of source code.
Understanding TS18003: No Inputs Were Found in tsconfig.json for TypeScript Builds
Learn why TS18003 happens in tsconfig.json, how include and exclude work, and how to fix missing TypeScript input files in builds.
Understanding Type 'string | undefined' Is Not Assignable to Type 'string' in TypeScript
Learn why optional properties become string | undefined in TypeScript and how to handle them safely with checks, defaults, and assertions.
Understanding TypeScript Record<K, T>: Definition, Usage, and Examples
Learn what Record<K, T> means in TypeScript, how it works, when to use it, and how it compares to object types and mapped types.
Understanding `keyof typeof` in TypeScript
Learn what `keyof typeof` means in TypeScript, how it works with enums and objects, and when to use it to create safe key unions.
Understanding esModuleInterop and allowSyntheticDefaultImports in TypeScript
Learn what esModuleInterop and allowSyntheticDefaultImports do in TypeScript, how they affect imports, and when to enable them.
Understanding npm Peer Dependencies in Angular Projects
Learn what npm peer dependency warnings mean, why Angular package versions conflict, and how to fix mismatched dependencies safely.
Understanding the 'React' Refers to a UMD Global Error in TypeScript
Learn why TypeScript shows the 'React refers to a UMD global' error in TSX files and how the new React JSX transform affects imports.
Understanding the Experimental Decorators Warning in TypeScript
Learn why TypeScript shows the experimental decorators warning, even with tsconfig settings enabled, and how to troubleshoot it correctly.
Using process.env in TypeScript: Read Node Environment Variables Safely
Learn how to read process.env variables in TypeScript, configure Node types, add typed environment declarations, and handle missing values safely.
What Is TypeScript and Why Use It Instead of JavaScript?
Learn what TypeScript is, how it extends JavaScript, and why developers use it for safer code, better tooling, and easier maintenance.
What `as const` Means in TypeScript and When to Use It
Learn what `as const` does in TypeScript, how it affects literals and readonly tuples, and why it helps with safer code.
What `declare` Means in TypeScript
Learn the purpose of the `declare` keyword in TypeScript, when to use it, how it differs from normal declarations, and common mistakes.
When to Put @types Packages in dependencies vs devDependencies in TypeScript
Learn how to decide whether @types packages belong in dependencies or devDependencies in TypeScript projects and libraries.