D
Deno

help

vscode unable to resolve types

FSFilip Seman11/19/2022
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
DDoctor11/19/2022
Your images don’t match the codeblock.
FSFilip Seman11/19/2022
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"
}
}
DDoctor11/19/2022
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?
DDoctor11/19/2022
FSFilip Seman11/19/2022
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

Looking for more? Join the community!

Recommended Posts
Converting Typescript Types to JSON Schema (Props definition)?Folks, We're creating a CMS solution using Deno and Fresh. For our product goals, we want to dynamiWhat would the benefits for Deno + VueJS (for the frontend only) be?So basicly using: deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest deno VScode Deno Extensions produces constant errorsI am currently using Deno with Opine in order to rewrite an API from JS to TS. While Opine only is uProblem with Mongoose + authHi i followed the mongoose example provided by denoland, but if my local database has authenticatiodeno_core run files concurrentlyIs is possible to run multiple files concurrently using the `deno_core` crate?deno.lock multiple entry point best practicesHi, I just upgraded to 1.28.0 and realized that lock files are here by default for deno.json config About performanceif a function takes only one paramater and i pass unnecessary additional parameters would it affect deno_core Extension with Global AccessIs there a way to make a Deno Extension be accessed by `Extension.op()` instead of `Deno.core.ops.opHow to stop reading from a ReadableStream?```js let user for await (const data of readable) { if (data.user.id === 'user-id') { user = Deno.inspect, how to log class instances with gettersim trying to log a class instance that has getters in it, with `Deno.inspect` ```ts Deno.inspect(clhow to ssr preact (without fresh)i tried with preact render to string but it wouldnt ship any jsSynchronous read single line from Deno.stdinHi, how would I go about reading a single line from `Deno.stdin` synchronously?Closing a websocket server in a unit testHello, I'm an author of [rpc lib](https://github.com/deno-libs/rpc) and I'm currently writing unit tHow to cancel or abort .pipeTo()?I prefer not asking, but after I found (what I consider) an MDN easter egg, I realized this is probais it possible to change how tsx bundles to js?So I’m wondering if it’s possible to get Deno to convert ```jsx <div class="test">Potato</div> ``` tcan't load external modules when run as child process with Deno.spawnChildHi! This is really weird, but I'm trying to run deno scripts under another deno process with Deno.sp