SteveS
SteveS3mo 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.3mo ago
Looks like the Deno extension isn't enabled for this particular project. Run the Deno: Enable command in the vscode command palette
SteveS
SteveSOP3mo ago
I believe it is. I ran the command anyway and reloaded vscode and it didn't change anything
No description
SteveS
SteveSOP3mo ago
Additionally, the $lib import works in files inside the lib directory
SteveS
SteveSOP3mo ago
No description
SteveS
SteveSOP3mo 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?

Did you find this page helpful?