-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
Describe the bug
To Reproduce
deno.jsonc
:
{
"nodeModulesDir": "none",
"imports": {
"react": "npm:react@^19.1.0",
//"@types/react": "npm:@types/react@^19.1.8"
}
}
test.ts
:
import { useState, aaaaa } from 'react'
import { bbbbb } from 'ccccc'
const x = useState
const y = aaaaa
const z = bbbbb
console.log(x)
console.log(y)
console.log(z)
I set up these files with an npm
import, without node_modules
dir, but was missing the @types
import.
- Running
test.ts
correctly shows error for the missingccccc
. This is correctly highlighted red in VSCode (first screenshot).
deno run --allow-env test.ts
error: Relative import path "ccccc" not prefixed with / or ./ or ../ and not in import map from "file:///[omitted]/test.ts"
at file:///[omitted]/test.ts:2:23
# no error?
deno check test.ts
Check file:///[omitted]/test.ts
- If I comment out
ccccc
andz
, deno correctly shows an error for the missing import. VSCode does resolvereact
but does not show the same as an error or a warning. (second screenshot)
VSCode shows the type ofx
andy
asany
. (third screenshot)
deno run --allow-env test.ts
error: Uncaught SyntaxError: The requested module 'react' does not provide an export named 'aaaaa'
import { useState, aaaaa } from 'react'
^
# no error?
deno check test.ts
Check file:///[omitted]/test.ts
- If I comment out
aaaaa
andy
, VSCode shows the type ofx
asany
. deno allows this to run, I thought it was set by default tostrict
andnoImplicitAny
? What settings do I need to have "no implicit any" enforced on these imports?
deno run --allow-env test.ts
[Function (anonymous)]
# no output?
deno check test.ts
- If I add
@types/react
, VSCode correctly shows a red error foraaaaa
and shows the types foruseState
andx
. (fifth/sixth screenshots)
Expected behavior
When missing @types/react
, VSCode should show a warning or error for the implicit any
types imported from react
. Currently no error. (third screenshot)
Screenshots
In both cases, the missing ccccc
correctly shows error:
Without @types/react
, react
resolves but no warning or error on aaaaa
. x
and y
have type any
with no warning or error. useState
and aaaaa
just show import aaaaa
.
With @types/react
, correctly shows error for aaaaa
and resolves types for x
and useState
:
Versions
vscode: 1.102.2 (Universal)
deno: 2.4.2 (stable, release, aarch64-apple-darwin)
extension: 3.45.0
Metadata
Metadata
Assignees
Labels
No labels