Types derived from HANDLE do not work and default to any, likely due to a missing dependency in win32-def
Steps to reproduce
npm init -y
npm install typescript @types/node win32-def
node_modules\.bin\tsc --init
- create
app.ts:
import type { HANDLE } from 'win32-def/types'
let testVar: HANDLE
- edit
tsconfig.json:
"module": "nodenext", // or "preserve"
"moduleResolution": "nodenext", // or "bundler"
"skipLibCheck": false
- open
app.ts in VS Code and hover mouse over testVar
node_modules\.bin\tsc --noEmit
Expected outcome
- type of
testVar is HANDLE or number or similar
tsc produces no errors
Actual outcome
- type of
testVar is any
tsc produces this:
node_modules/win32-def/src/lib/common.types.ts:6:32 - error TS2307: Cannot find module '@waiting/shared-types' or its corresponding type declarations.
6 import type { BigIntStr } from '@waiting/shared-types'
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/win32-def/src/lib/ffi.types.ts:3:51 - error TS2307: Cannot find module '@waiting/shared-types' or its corresponding type declarations.
3 import type { BigIntStr, MethodTypeUnknown } from '@waiting/shared-types'
~~~~~~~~~~~~~~~~~~~~~~~
node_modules/win32-def/src/lib/types.ts:2:38 - error TS2307: Cannot find module '@waiting/shared-types' or its corresponding type declarations.
2 import type { ToAsyncFunction } from '@waiting/shared-types'
~~~~~~~~~~~~~~~~~~~~~~~
Found 3 errors in 3 files.
Errors Files
1 node_modules/win32-def/src/lib/common.types.ts:6
1 node_modules/win32-def/src/lib/ffi.types.ts:3
1 node_modules/win32-def/src/lib/types.ts:2
Workaround
npm install @waiting/shared-types
Note that there are further type errors in this package, so it's probably best to reset skipLibCheck to true
Types derived from
HANDLEdo not work and default toany, likely due to a missing dependency inwin32-defSteps to reproduce
npm init -ynpm install typescript @types/node win32-defnode_modules\.bin\tsc --initapp.ts:tsconfig.json:app.tsin VS Code and hover mouse overtestVarnode_modules\.bin\tsc --noEmitExpected outcome
testVarisHANDLEornumberor similartscproduces no errorsActual outcome
testVarisanytscproduces this:Workaround
npm install @waiting/shared-typesNote that there are further type errors in this package, so it's probably best to reset skipLibCheck to true