Closed zgpio closed 2 years ago
maybe lack of types in win32-def/packages.json. pls try latest version v19.8.3. if still error, i'll change it point to dist/...
I tried latest version v19.8.3,still have the same error.
And, if I don't remove "types": "src/index.ts"
in win32-def/package.json
, the v19.8.3 also adds the following error:
node_modules/win32-def/src/lib/helper.ts:4:21 - error TS7016: Could not find a declaration file for module 'ref-union-di'. 'C:/Users/zhaoguopan/electron-quick-start-typescrip
t/node_modules/ref-union-di/lib/union.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/ref-union-di` if it exists or add a new declaration (.d.ts) file containing `declare module 'ref-union-di';`
4 import UnionDi from 'ref-union-di'
~~~~~~~~~~~~~~
node_modules/win32-def/src/lib/helper.ts:15:3 - error TS2578: Unused '@ts-expect-error' directive.
15 // @ts-expect-error
~~~~~~~~~~~~~~~~~~~
node_modules/win32-def/src/lib/helper.ts:19:3 - error TS2578: Unused '@ts-expect-error' directive.
19 // @ts-expect-error
~~~~~~~~~~~~~~~~~~~
Give me a sample repo to test ?
Please use hello world, and yarn add win32-api
and add follow in src/main.ts
import { CS } from 'win32-api'
After this, execute yarn start
, then you will find error.
It works node
tsc
Check the pkg size under node_modules:
Can you reproduce this problem?
Fixed it with new version and config. wait a moment.
Update:
package.json
"dependencies": {
"win32-api": "^20.0.0",
"ffi-napi": "^4.0.3",
"ref-napi": "^3.0.3",
"ref-struct-di": "^1.1.1",
"ref-union-di": "^1.0.1"
}
tsconfig.json:
{
"compilerOptions": {
......................
"skipLibCheck": true
},
}
I have verified it, close it.
Change
"types": "src/index.ts"
to"types": "./dist/index.d.ts"
inwin32-api/package.json
, the error below disappear, but why.