restore-default-typeroots-resolution: Restore default TypeScript @types resolution alongside local types #5

Open
std-bot wants to merge 1 commit from task/restore-default-typeroots-resolution into main
First-time contributor

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 --noEmit and confirm it completes without "Cannot find type definition file" / missing module declaration errors; also confirm that local declarations under types/ 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

## 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 --noEmit` and confirm it completes without "Cannot find type definition file" / missing module declaration errors; also confirm that local declarations under `types/` 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 <!-- std-ts:idea-pr-body -->
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/restore-default-typeroots-resolution:task/restore-default-typeroots-resolution
git switch task/restore-default-typeroots-resolution

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.

git switch main
git merge --no-ff task/restore-default-typeroots-resolution
git switch task/restore-default-typeroots-resolution
git rebase main
git switch main
git merge --ff-only task/restore-default-typeroots-resolution
git switch task/restore-default-typeroots-resolution
git rebase main
git switch main
git merge --no-ff task/restore-default-typeroots-resolution
git switch main
git merge --squash task/restore-default-typeroots-resolution
git switch main
git merge --ff-only task/restore-default-typeroots-resolution
git switch main
git merge task/restore-default-typeroots-resolution
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
snorkel/root-repository-maintenance-8ac8ec1620d541!5
No description provided.