Clean install of Sage 10 --dev
As soon as I open it in VS Code, jsconfig.json
is red, with this error
Cannot find type definition file for '@roots/sage'.
The file is in the program because:
Entry point of type library '@roots/sage' specified in compilerOptions
Are there extra types definitions to be installed? nothing in docs…
To be clear to anyone looking for information on a build error: this isn’t a build error. It’s a problem with type resolution in vscode. Whether or not you would see it depends on the version of TypeScript available to vscode from the project.
TLDR: update to 6.7.3.
In bud@6.7.0 I had transitioned @roots/sage
to use the new package.json
syntax for declaring types released in typescript@4.7:
{
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./acorn": {
"types": "./lib/acorn/index.d.ts",
"default": "./lib/acorn/index.js"
},
// ...
}
}
I realized after release that there weren’t any guarantees that an IDE would use >= 4.7. Now, we’re back to adding a fallback (6.7.3):
{
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./acorn": {
"types": "./lib/acorn/index.d.ts",
"default": "./lib/acorn/index.js"
},
// ...
},
"typesVersions": {
"*": {
".": [
"./lib/index.d.ts"
],
"acorn": [
"./lib/acorn/index.d.ts"
],
// ...
}
}
}
Which is a big
from me cos it makes the package.json
absurdly long. But it also helps make type resolution more robust so my feelings don’t really matter much here. I think there are other packages that need legacy declarations added back in but it’s not a problem that breaks things in obvious ways so it’s not a massive priority.
2 Likes