Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npm run build" Fails - error TS2345 #903

Closed
abu-co opened this issue Aug 30, 2020 · 3 comments · Fixed by #907
Closed

"npm run build" Fails - error TS2345 #903

abu-co opened this issue Aug 30, 2020 · 3 comments · Fixed by #907

Comments

@abu-co
Copy link
Contributor

abu-co commented Aug 30, 2020

npm --version
6.14.8

node --version
v14.9.0

npx tsc --version
Version 4.1.0-dev.20200829

> tsjs-lib-generator@ build ..\TSJS-lib-generator-master
> tsc -p ./tsconfig.json && node ./lib/index.js

src/widlprocess.ts:36:89 - error TS2345: Argument of type 'CallbackInterfaceType' is not assignable to parameter of type 'InterfaceType'.
  Property 'inheritance' is missing in type 'CallbackInterfaceType' but required in type 'InterfaceType'.

36             browser["callback-interfaces"]!.interface[rootType.name] = convertInterface(rootType, commentMap);
                                                                                           ~~~~~~~~

  node_modules/@types/webidl2/index.d.ts:157:5
    157     inheritance: string | null;
            ~~~~~~~~~~~
    'inheritance' is declared here.


Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! tsjs-lib-generator@ build: `tsc -p ./tsconfig.json && node ./lib/index.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the tsjs-lib-generator@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     %APPDATA%\npm-cache\_logs\2020-08-30T02_04_54_901Z-debug.log

%APPDATA%\npm-cache_logs\2020-08-30T02_04_54_901Z-debug.log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'F:\\Node.js\\nodejs\\node.exe',
1 verbose cli   'F:\\Node.js\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.9.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle tsjs-lib-generator@~prebuild: tsjs-lib-generator@
6 info lifecycle tsjs-lib-generator@~build: tsjs-lib-generator@
7 verbose lifecycle tsjs-lib-generator@~build: unsafe-perm in lifecycle true
8 verbose lifecycle tsjs-lib-generator@~build: PATH: F:\Node.js\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;..\TSJS-lib-generator-master\node_modules\.bin;<%OTHER_PATHS...%>;%APPDATA%\npm
9 verbose lifecycle tsjs-lib-generator@~build: CWD: ..\TSJS-lib-generator-master
10 silly lifecycle tsjs-lib-generator@~build: Args: [ '/d /s /c', 'tsc -p ./tsconfig.json && node ./lib/index.js' ]
11 silly lifecycle tsjs-lib-generator@~build: Returned: code: 2  signal: null
12 info lifecycle tsjs-lib-generator@~build: Failed to exec build script
13 verbose stack Error: tsjs-lib-generator@ build: `tsc -p ./tsconfig.json && node ./lib/index.js`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (F:\Node.js\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (F:\Node.js\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1047:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid tsjs-lib-generator@
15 verbose cwd ..\TSJS-lib-generator-master
16 verbose Windows_NT 10.0.18363
17 verbose argv "F:\\Node.js\\nodejs\\node.exe" "F:\\Node.js\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.9.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 2
22 error tsjs-lib-generator@ build: `tsc -p ./tsconfig.json && node ./lib/index.js`
22 error Exit status 2
23 error Failed at the tsjs-lib-generator@ build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
@abu-co
Copy link
Contributor Author

abu-co commented Sep 5, 2020

The inheritance issue was fixed by @saschanaz... But a new issue is present. Perhaps a convertCallbackInterface function should be created, or maybe just accept it in convertInterface?

src/widlprocess.ts:36:89 - error TS2345: Argument of type 'CallbackInterfaceType' is not assignable to parameter of type 'InterfaceType'.
  Types of property 'type' are incompatible.
    Type '"callback interface"' is not assignable to type '"interface"'.

36             browser["callback-interfaces"]!.interface[rootType.name] = convertInterface(rootType, commentMap);
                                                                                           ~~~~~~~~


Found 1 error.

npm ERR! Test failed.  See above for more details.

@saschanaz
Copy link
Contributor

saschanaz commented Sep 9, 2020

Now it also has TS2349.

> tsc -p ./tsconfig.json && node ./lib/index.js && node ./lib/test.js

src/expose.ts:144:18 - error TS2349: This expression is not callable.
  Each member of the union type '(<U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]) | (<U>(callbackfn: (value: any, index: number, array: readonly any[]) => U, thisArg?: any) => U[])' has signatures, but none of those signatures are compatible with each other.

144         return o.map(v => deepClone(v, custom)) as any as T;
                     ~~~

src/expose.ts:144:22 - error TS7006: Parameter 'v' implicitly has an 'any' type.

144         return o.map(v => deepClone(v, custom)) as any as T;
                         ~

src/helpers.ts:67:38 - error TS2345: Argument of type 'T[Extract<keyof T, string>] & (T[Extract<keyof T, string>] extends readonly any[] ? unknown extends T[Extract<keyof T, string>] ? never : readonly any[] : any[])' is not assignable to parameter of type 'any[]'.      

67                     mergeNamedArrays(targetProp, srcProp);
                                        ~~~~~~~~~~

src/widlprocess.ts:36:89 - error TS2345: Argument of type 'CallbackInterfaceType' is not assignable to parameter of type 'InterfaceType'.
  Types of property 'type' are incompatible.
    Type '"callback interface"' is not assignable to type '"interface"'.

36             browser["callback-interfaces"]!.interface[rootType.name] = convertInterface(rootType, commentMap);
                                                                                           ~~~~~~~~


Found 4 errors.

npm ERR! Test failed.  See above for more details.

@saschanaz
Copy link
Contributor

Filed microsoft/TypeScript#40463 as it's a nightly regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants