Skip to content

Commit

Permalink
fix: use a custom typings directory
Browse files Browse the repository at this point in the history
Fixes language-tools test failure.
Closes vuejs/language-tools#3759

This is because according to TypeScript documentation,
> Packages in `node_modules/@types` of any enclosing folder are
considered *visible*.

So we can't have `@types` in the root `node_modules` folder, otherwise
ecosystem projects in the `workspace` folder will be able to see them,
and that might affect the type checking result.
  • Loading branch information
haoqunjiang committed Nov 30, 2023
1 parent 156d2e4 commit af22599
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"devDependencies": {
"@antfu/ni": "^0.21.4",
"@types/node": "^18.16.19",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.45.0",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"useUnknownInCatchVariables": false,
"allowSyntheticDefaultImports": true,
"lib": ["esnext"],
"sourceMap": true
"sourceMap": true,
"typeRoots": ["./typings/node_modules/@types"]
}
}
9 changes: 9 additions & 0 deletions typings/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "typings",
"version": "0.0.0",
"private": true,
"description": "Alternative typing root directory for the project in order not to pollute the root node_modules",
"devDependencies": {
"@types/node": "^18.18.14"
}
}
22 changes: 22 additions & 0 deletions typings/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit af22599

Please sign in to comment.