Phil
Phil•2mo ago

deno-rc: JSX in VSCode

I've jumped up to the deno rc (2.0.0-rc.5) which nicely solves a gnarli NPM import error. I'm in a mono-repo deno "workspace", with a deno.json at the root contining: "compilerOptions": { "strict": true, "lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"], "jsx": "react", "jsxFactory": "React.createElement", "jsxFragmentFactory": "React.Fragment" }, and in a sub-folder, a module that contains the module level deno.json (name/version) with some JSX within .tsx files. The app runs, but the VSCode editor is not recognizing the angle-brackets, throwing underline errors in the IDE. I'm wondering, is it reaonable to assume this is "release candidate" friction? OR is what I've described obviously wrong, for getting the JSX.IntrinsicElements to register? Thanks!
No description
5 Replies
Phil
PhilOP•2mo ago
(NOTE: this earlier message deleted from #general from yesterday, as it look like #help is the more appropriate channel). :deno_thankyou:
bartlomieju
bartlomieju•2mo ago
CC @nayeemrmn
marvinh.
marvinh.•2mo ago
This might be related to React not publishing types in their package. They are in @types/react.
nayeemrmn
nayeemrmn•2mo ago
@Phil Yeah, if you have an import to react, add // @deno-types="@types/react" above it.
Phil
PhilOP•2mo ago
Ah, thanks @nayeemrmn I Have globalised that within my root deno.json file with with the jsxImportSourceTypes entry:
"compilerOptions": {
"strict": true,
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns", "esnext"],
"jsx": "react-jsx",
"jsxImportSource": "react",
"jsxImportSourceTypes": "@types/react"
},
"compilerOptions": {
"strict": true,
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns", "esnext"],
"jsx": "react-jsx",
"jsxImportSource": "react",
"jsxImportSourceTypes": "@types/react"
},
Appreciate everyone's help! 🙇