- Home
- Skills
- Nevaberry
- Nevaberry Plugins
- Typescript Knowledge Patch
typescript-knowledge-patch_skill
6
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill nevaberry/nevaberry-plugins --skill typescript-knowledge-patch- SKILL.md3.0 KB
Overview
This skill provides up-to-date guidance and quick fixes for TypeScript features and breaking changes introduced in TypeScript 5.9 and the TS7 transition. It highlights new syntax like import defer, the stable --module node20 option, updated tsc --init defaults, ArrayBuffer narrowing, and changes to type argument inference. Use it while writing or migrating TypeScript code to avoid common pitfalls and to apply concrete workarounds.
How this skill works
The skill inspects code patterns and compiler configurations to detect usage that may be affected by 5.9 changes. It explains allowed forms (for example, the restricted import defer namespace form), recommends compiler options (node20 vs nodenext), and suggests minimal code edits for breaking changes like ArrayBuffer narrowing and inference leaks. It also summarizes the new default tsconfig snippet and points to upgrade steps for related ambient types such as @types/node.
When to use it
- When adding or reviewing code that imports modules lazily or using new import forms (import defer).
- When choosing a stable Node.js module target for builds or tools (--module node20).
- When running tsc --init and wanting the modern minimal default tsconfig.
- When TypeScript errors appear after upgrading to 5.9 related to ArrayBuffer or typed arrays.
- When generic type inference stops working and explicit type arguments may be required.
- When preparing for the TS7 native port and assessing migration impact.
Best practices
- Use import defer only as a namespace import: import defer * as name from './mod.js'.
- Prefer --module node20 for stable, non-moving Node.js module semantics; use nodenext to follow latest Node behavior.
- Adopt the new minimal tsconfig defaults and rely on editor autocompletion for optional flags.
- When passing typed arrays to APIs expecting ArrayBuffer, use .buffer or update parameter types to accept TypedArray types.
- Be explicit with generic type arguments when inference produces errors after upgrading.
- Update related declaration packages (for example @types/node) when encountering platform type regressions.
Example use cases
- Refactoring lazy-loaded feature modules to use import defer for zero-cost startup until an export is accessed.
- Configuring a build for Node.js 20 behavior in a library or service using --module node20 for predictable output.
- Regenerating tsconfig with tsc --init to get modern safe defaults and removing commented legacy options.
- Fixing a compilation error where a function accepting ArrayBuffer no longer accepts a Uint8Array by switching to arr.buffer.
- Resolving a broken generic helper by adding an explicit type parameter where type variable leaks were prevented.
FAQ
No. import defer only supports namespace imports (import defer * as name). Named and default imports are not allowed.
When should I pick node20 vs nodenext?
Pick node20 for stable, unchanging Node.js-20 semantics. Use nodenext if you want the compiler to track the latest Node behavior.