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

Fixes duplicate identifier issue by ignoring type checking of .d.ts files in node_modules #298

Merged
merged 6 commits into from
Oct 18, 2021

Conversation

scalvert
Copy link
Contributor

Currently, when attempting to release, we're encountering a TS compilation error:

node_modules/@types/eslint/helpers.d.ts:1:6 - error TS2300: Duplicate identifier 'Prepend'.

1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends ((
       ~~~~~~~

  ../node_modules/@types/eslint/helpers.d.ts:1:6
    1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
           ~~~~~~~
    'Prepend' was also declared here.

node_modules/@types/eslint/lib/rules/index.d.ts:10:14 - error TS2300: Duplicate identifier 'Rule'.

10     export = Rule;
                ~~~~

  ../node_modules/@types/eslint/lib/rules/index.d.ts:10:14
    10     export = Rule;
                    ~~~~
    'Rule' was also declared here.

../node_modules/@types/eslint/helpers.d.ts:1:6 - error TS2300: Duplicate identifier 'Prepend'.

1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
       ~~~~~~~

  node_modules/@types/eslint/helpers.d.ts:1:6
    1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends ((
           ~~~~~~~
    'Prepend' was also declared here.

../node_modules/@types/eslint/lib/rules/index.d.ts:10:14 - error TS2300: Duplicate identifier 'Rule'.

10     export = Rule;
                ~~~~

  node_modules/@types/eslint/lib/rules/index.d.ts:10:14
    10     export = Rule;
                    ~~~~
    'Rule' was also declared here.


Found 4 errors.

The solution to this is to add the skipLibCheck option to the tsconfig.json. This will effectively ignore .d.ts files in node_modules, avoiding this issue.

Also adding TS linting to our workflow to avoid this in the future.

@rwjblue
Copy link
Member

rwjblue commented Oct 16, 2021

I think the CI failures were due to socketio/socket.io#4121 which is resolved now. Might need to re-roll lock file though.

@scalvert scalvert merged commit dff095f into master Oct 18, 2021
@scalvert scalvert deleted the fix-ts-duplicate-identifier branch October 18, 2021 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants