anderspitman / graphml-js

GraphML parser for javascript
MIT License
12 stars 2 forks source link

Unable to compile sources #1

Closed shinnya closed 7 years ago

shinnya commented 7 years ago

Hi. I've found an issue that compiling sources using gulp fails. The error messages are following:

$ node -v
v8.6.0

$ npm -v
5.3.0

$ gulp -v
[12:29:46] CLI version 3.9.1
[12:29:46] Local version 3.9.1

$ gulp
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(70,5): error TS2403: Subsequent variable declarations must have the same type.  V
ariable 'main' must be of type 'any', but here has type 'NodeModule'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(81,5): error TS2403: Subsequent variable declarations must have the same type.  V
ariable 'parent' must be of type 'any', but here has type 'NodeModule'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(82,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(102,6): error TS2300: Duplicate identifier 'BufferEncoding'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(266,9): error TS2403: Subsequent variable declarations must have the same type.
Variable 'errno' must be of type 'string', but here has type 'number'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(273,18): error TS2300: Duplicate identifier 'EventEmitter'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(378,9): error TS2403: Subsequent variable declarations must have the same type.
Variable 'stdout' must be of type 'WritableStream', but here has type 'WriteStream'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(379,9): error TS2403: Subsequent variable declarations must have the same type.
Variable 'stderr' must be of type 'WritableStream', but here has type 'WriteStream'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(380,9): error TS2403: Subsequent variable declarations must have the same type.
Variable 'stdin' must be of type 'ReadableStream', but here has type 'ReadStream'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(430,9): error TS2403: Subsequent variable declarations must have the same type.
Variable 'platform' must be of type 'string', but here has type 'Platform'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(588,26): error TS2300: Duplicate identifier 'Buffer'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(588,50): error TS2300: Duplicate identifier 'SlowBuffer'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(632,5): error TS2309: An export assignment cannot be used in a module with other
exported elements.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(777,18): error TS2300: Duplicate identifier 'Agent'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(835,18): error TS2300: Duplicate identifier 'Worker'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(1179,16): error TS2403: Subsequent variable declarations must have the same type.
  Variable 'constants' must be of type '{ UV_UDP_REUSEADDR: number; errno: { SIGHUP: number; SIGINT: number; SIGQUIT: number; SIGILL: num...', but here has type '{ UV_UD
P_REUSEADDR: number; signals: { SIGHUP: number; SIGINT: number; SIGQUIT: number; SIGILL: n...'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(1525,17): error TS2300: Duplicate identifier 'CompleterResult'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(1562,18): error TS2300: Duplicate identifier 'Script'.
/Users/syamaoka/repos/github.com/shinnya/graphml-js/node_modules/@types/node/index.d.ts(2067,16): error TS2403: Subsequent variable declarations must have the same type.
  Variable 'Socket' must be of type 'new (options?: { fd?: string; type?: string; allowHalfOpen?: boolean; }) => Socket', but here has type 'new (options?: { fd?: number
; allowHalfOpen?: boolean; readable?: boolean; writable?: boolean; })...'.
...

It seems that this project has two type definitions for node.d.ts and it causes the above issue.

See https://stackoverflow.com/questions/39894240/typescript-compiler-suddenly-started-to-generate-errors, which is similar to this issue.

P.S. I'm fixing the issue and will send a PR.

Thank you.

shinnya commented 7 years ago

typings has been deprecated(see https://github.com/typings/typings) and it's recommended that we should switch to @types.

Then, without typings, we have to generate index.d.ts manually and there some ways to archive this goal. It might be reasonable to enable declaration compliler option defined in typescript.