Filip Seman
Filip Semanβ€’2y ago

vscode unable to resolve types

I'm testing npm integration, simple lodash example
// @deno-types="npm:@types/lodash"
import lodash from "npm:lodash";

// some code...
// @deno-types="npm:@types/lodash"
import lodash from "npm:lodash";

// some code...
After running the code and the package being cached, the code runs without errors, but vscode can't resolve the typings. All plugins are disabled except Deno Deno latest v1.28.1 Deno plugin, latest v3.14.1
code --version
# 1.73.1
# 6261075646f055b99068d3688932416f2346dd3b
# x64
code --version
# 1.73.1
# 6261075646f055b99068d3688932416f2346dd3b
# x64
5 Replies
Doctor πŸ€–
Doctor πŸ€–β€’2y ago
Your images don’t match the codeblock.
Filip Seman
Filip Semanβ€’2y ago
Oh, you're right that blocks are after testing import_maps.json
{
"imports": {
"lodash": "npm:lodash",
"@types/lodash": "npm:@types/lodash"
}
}
{
"imports": {
"lodash": "npm:lodash",
"@types/lodash": "npm:@types/lodash"
}
}
Doctor πŸ€–
Doctor πŸ€–β€’2y ago
I’m not familiar with import maps, but does the extension know about it? In .vscode/settings.json do you have the deno.importMap key?
Doctor πŸ€–
Doctor πŸ€–β€’2y ago
Filip Seman
Filip Semanβ€’2y ago
Ok, I'm an idiot, basic npm:@types/lodash works, I forgot about Deno: init workspace because I'm experimenting with multiple folder structures and root has deno.enable: true, but each folder is its own workspace space, so everyone needs deno.enable: true. Now typings works. For import_maps it just occurred to me now deno.json is required to points to the import map {"importMap": "./import_map.json"} so vscode plugin can infer this information. Thanks! Also importMap key works, i thought it was enabled by default globally to import_map.json