Closed d9k closed 7 months ago
I had similar, but more critical issue (not only Go to definition
didn't work, but there were TypeScript compilation error) with react-fela
and I solved it like this:
// @deno-types="./index.d.ts"
export * from 'react-fela';
If while having in importMap.json
:
"react": "https://esm.sh/react@18.2.0?dev",
"@types/react": "https://esm.sh/v128/@types/react@18.2.38/index.d.ts",
I try similar stuff with react: src/deps/react.ts
:
// @deno-types="@types/react"
export * from "react";
I get error
Module '"https://esm.sh/v128/@types/react@18.2.38/index"' uses 'export =' and cannot be used with 'export *'.deno-ts(2498)
And in src/app.ts
:
`import { useEffect, useState } from "./deps/react.ts"`:
Error Module '"./deps/react.ts"' has no exported member 'useEffect'.deno-ts(2305)
.
// @deno-types="@types/react"
export {
useState,
useEffect,
} from "https://esm.sh/react@18.2.0?dev"
This does work (and Go to definition
VSCode command too) but now I must reexport every react
module member manually by name.
After experimenting in another branch (see deps/react.ts) seems @types/react
somehow propely cached and issue with Go to definition
doesn't appears anymore (in other local ultra projects too).
Very strange...
Before opening this issue I tried rm -r ~/.cache/deno
and restarting VS Code. It didn't help.
Will close issue for now because it have not clearly steps to reproduce.
Created Ultra project with
deno run -A -r https://deno.land/x/ultra/create.ts
using these answers.Then opened VS Code IDE + Deno plugin at https://github.com/d9k/d9k-examples/blob/main/ts/ultra-demo-react-autocomplete/src/app.tsx:
Go to definition
VSCode command doesn't work for React imports (useEffect
,useState
).Versions
VSCode Deno extension plugin
:v 3.29.0
Ultra
:v 2.3.8