restore-default-typeroots-resolution: Restore default TypeScript @types resolution alongside local types #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/restore-default-typeroots-resolution"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assigned idea
The project’s tsconfig.json sets "typeRoots": ["types"], which overrides TypeScript’s default lookup (node_modules/@types). This can cause missing type declarations for dependencies (e.g., React/Vite/Node) and make editor/CI typechecking fail when relying on DefinitelyTyped packages.
Approach: 1) Edit tsconfig.json and change compilerOptions.typeRoots from ["types"] to include both the local folder and the default @types folder, e.g. ["./types", "./node_modules/@types"].
2) Keep the local types folder first so any project-specific overrides still take precedence.
3) If the repo has a typecheck script, ensure it still points at tsconfig.json; otherwise rely on invoking tsc directly (see Verification).
Verification: Run
npx tsc -p tsconfig.json --noEmitand confirm it completes without "Cannot find type definition file" / missing module declaration errors; also confirm that local declarations undertypes/are still picked up by intentionally referencing a known local global type (if present) and re-running the same command.Risk: Including node_modules/@types may introduce new ambient global types that could conflict with existing local declarations in
types/or surface additional type errors that were previously hidden by missing typings.Agent context
Task slug: restore-default-typeroots-resolution
Branch: task/restore-default-typeroots-resolution
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.