TypeScript
Types that pay for themselves: narrowing, inference, config and migration notes.
2026
- import defer for lazy module evaluationUse TypeScript's import defer syntax to move module evaluation from startup to the first namespace property read.
- erasableSyntaxOnly for Node type strippingTurn on erasableSyntaxOnly to catch enums and other TypeScript syntax that Node cannot run by stripping types.
- Type require(esm) from CommonJS in TypeScriptSelect a TypeScript module mode for synchronous require of ES modules, and check when your Node runtime needs dynamic import.
- Type Object.groupBy with the ES2024 libraryAdd ES2024 declarations for Object.groupBy without changing TypeScript's emit target, then handle missing groups and check support in your runtime.
- Rewrite .ts import paths on emitWrite relative .ts imports for source execution and emit runnable .js imports with TypeScript's rewriteRelativeImportExtensions option.
- Split TypeScript emit with --noCheckSplit JavaScript emit from type checking with tsc --noCheck, then require both CI jobs before you release a build.
- Disallowed nullish and truthy checksFix two TypeScript 5.6 diagnostics by testing a regex against its input and applying a default before negating a boolean.
- Regex syntax errors caught at compile timeCatch malformed regular expression literals with tsc, and test the separate runtime path for patterns passed to the RegExp constructor.
- Annotate exports for isolated declaration emitUse isolatedDeclarations to find exports that need annotations before a file-by-file tool can emit declaration files for your TypeScript library.
- Keep defaults from widening types with NoInferUse TypeScript’s NoInfer to check a default against the choices in a list without letting the default widen the inferred union.
2025
- Narrowing survives closures after last assignmentTypeScript 5.4 preserves some narrowings inside callbacks after the last assignment. Check when you can remove the non-null assertion.
- Typed JSON imports with import attributesGive TypeScript the shape of a JSON settings file and use import attributes to load it in a Node ES module.
- Getters and setters with unrelated typesAccept text on assignment, validate it in the setter, and give readers a number with an independently typed getter.
- Pick moduleResolution by what runs your codeChoose a resolution mode based on whether Node or a bundler resolves the imports you write.
- Standard decorators in TypeScriptWrite a standard method decorator in TypeScript, compile it to JavaScript and run it in Node.
- const type parameters keep literal typesUse a const type parameter with a readonly constraint to infer literal tuples from inline arrays.
- Key remapping with as in mapped typesUse as in a mapped type to derive getter names and event handlers from the keys of an object type.
- Template literal types for typed route stringsDerive parameters from a literal route so TypeScript catches missing or misspelled keys at the call site.
- Omit a property from each union memberUse a distributive conditional type to omit a shared property and preserve narrowing on the resulting union.
- Why Object.keys returns string[]See why Object.keys returns string[] and use an explicit list of typed keys to index a known set of properties.