DenoDDeno
Powered by
Steve AS
Denoβ€’14mo agoβ€’
13 replies
Steve A

React types without @deno-types before every import?

I'm hoping someone can clear up a little snag for me. Is it actually necessary to include
// @deno-types="npm:@types/react"
// @deno-types="npm:@types/react"
above every single react import in every single file? I'm up-to-date with deno, I've got
npm:@types/react
npm:@types/react
in my types property of my compiler options, etc. I've been perusing issues and trying alternatives for hours, but it seems like this is the only option that actually works:

> deno --version
deno 2.1.5 (stable, release, aarch64-apple-darwin)
v8 13.0.245.12-rusty
typescript 5.6.2
> deno --version
deno 2.1.5 (stable, release, aarch64-apple-darwin)
v8 13.0.245.12-rusty
typescript 5.6.2


  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "react",
    "strict": true,
    "lib": [
      "dom",
      "dom.iterable",
      "dom.asynciterable",
      "deno.ns",
      "deno.unstable"
    ],
    "types": ["npm:@types/react", "npm:@types/react-dom"]
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "react",
    "strict": true,
    "lib": [
      "dom",
      "dom.iterable",
      "dom.asynciterable",
      "deno.ns",
      "deno.unstable"
    ],
    "types": ["npm:@types/react", "npm:@types/react-dom"]
  },


I've generally had a great time getting things going with Deno but this has been a brick wall
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

deno and @types/react
WerdoxWWerdox / help
2y ago
Deno Types
mostprodevMmostprodev / help
3y ago
To use @types/react, do I have to prefix all my React imports with // @deno-types ?
KituraKKitura / help
16mo ago