Spending some time to investigate problem: Migrating from typescript 4.9 to 5.7 causes issue with @types/wicg-file-system-access when using typeRoots
Because library uses typesVersions to define different typings for different typescript versions typeRoots ignores that defintion in libraries package.json
.json
"types": "index",
"typesVersions": {
"<=5.0": {
"*": [
"ts5.0/*"
]
}
},
{
"compilerOptions": {
"typeRoots": ["libs/sdk/types", "node_modules/@types"],
"types": [
"node",
"typelevel",
"react-util-types",
"browser-compat",
"@types/wicg-file-system-access",
"office-js"
],
}
}
not working anymore and causes error when loading typings
Spending some time to investigate problem: Migrating from typescript 4.9 to 5.7 causes issue with @types/wicg-file-system-access when using typeRoots
Because library uses typesVersions to define different typings for different typescript versions typeRoots ignores that defintion in libraries package.json
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wicg-file-system-access/package.json
"types": "index",
"typesVersions": {
"<=5.0": {
"*": [
"ts5.0/*"
]
}
},
{
"compilerOptions": {
"typeRoots": ["libs/sdk/types", "node_modules/@types"],
"types": [
"node",
"typelevel",
"react-util-types",
"browser-compat",
"@types/wicg-file-system-access",
"office-js"
],
}
}
not working anymore and causes error when loading typings
to solve problem change tsconfig like that
{
"compilerOptions": {
"typeRoots": ["libs/sdk/types", "node_modules/@types", "node_modules/@types/wicg-file-system-access"],
"types": [
"node",
"typelevel",
"react-util-types",
"browser-compat",
"ts5.0", // @types/wicg-file-system-access for 5.x typescript
"office-js"
],
}
}