-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Closed as not planned
Copy link
Description
🔎 Search Terms
is:issue is:open types empty tsconfig label:Bug
🕗 Version & Regression Information
- This is a crash
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about all sections under 'Common "Bugs" That Aren't Bugs'
- I was unable to test this on prior versions because _______
⏯ Playground Link
No response
💻 Code
Create a new npm project and add the dependencies:
npm init
npm install --save-dev typescript @types/node
Create tsconfig.json
in the same directory:
{
"compilerOptions": {
"target": "es2022",
"module": "nodenext",
"strict": true,
"types": []
},
"include": [
"index.ts"
]
}
And write index.ts
:
import 'os';
🙁 Actual behavior
npx tsc -p .
compiles with no errors.
🙂 Expected behavior
npx tsc -p .
should raise an error since types
is empty.
index.ts:1:8 - error TS2307: Cannot find module 'os' or its corresponding type declarations.
1 import 'os';
~~~~
Found 1 error in index.ts:1
Additional information about the issue
When modifying the import
statement in index.ts
as follows,
import {} from 'os';
tsc
reports an error as expected:
index.ts:1:16 - error TS2307: Cannot find module 'os' or its corresponding type declarations.
1 import {} from 'os';
~~~~
Found 1 error in index.ts:1
Metadata
Metadata
Assignees
Labels
No labels