SteveS
SteveS5d ago

Cannot get TS to accept $lib import alias

Super frustrating. I'm using sveltekit which has a default $lib import alias. I've added the alias to my deno.json, and the import itself works, but the TS error won't go away. Any ideas?
{
"tasks": {},
"imports": {
"$lib/": "./src/lib/"
}
}
{
"tasks": {},
"imports": {
"$lib/": "./src/lib/"
}
}
No description
5 Replies
marvinh.
marvinh.5d ago
Looks like the Deno extension isn't enabled for this particular project. Run the Deno: Enable command in the vscode command palette
SteveS
SteveS5d ago
I believe it is. I ran the command anyway and reloaded vscode and it didn't change anything
No description
SteveS
SteveS5d ago
Additionally, the $lib import works in files inside the lib directory
SteveS
SteveS5d ago
No description
SteveS
SteveS3d ago
I don't know what magic Deno does behind the scenes, but whatever the case it seems like the import mapping from deno.json doesn't make it to the ts server Adding my own tsconfig in the base directory with the "paths" configured the exact same as in my deno.json has fixed the issue. Will this cause other issues I'm not aware of?