Skip to content

set skipLibCheck to true in tsconfig#245

Merged
emin93 merged 1 commit into
react-native-community:mainfrom
sbalay:patch-1
Jan 31, 2022
Merged

set skipLibCheck to true in tsconfig#245
emin93 merged 1 commit into
react-native-community:mainfrom
sbalay:patch-1

Conversation

@sbalay

@sbalay sbalay commented Jan 30, 2022

Copy link
Copy Markdown
Contributor

when running tsc on a project inited with this template (v6.9.0), the following errors are thrown:

node_modules/@types/node/globals.d.ts:47:11 - error TS2300: Duplicate identifier 'AbortController'.

47 interface AbortController {
             ~~~~~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:435:15
    435 declare class AbortController {
                      ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.

node_modules/@types/node/globals.d.ts:60:11 - error TS2300: Duplicate identifier 'AbortSignal'.

60 interface AbortSignal {
             ~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:400:15
    400 declare class AbortSignal implements EventTarget {
                      ~~~~~~~~~~~
    'AbortSignal' was also declared here.

node_modules/@types/node/globals.d.ts:67:13 - error TS2300: Duplicate identifier 'AbortController'.

67 declare var AbortController: {
               ~~~~~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:435:15
    435 declare class AbortController {
                      ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.

node_modules/@types/node/globals.d.ts:72:13 - error TS2300: Duplicate identifier 'AbortSignal'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:400:15
    400 declare class AbortSignal implements EventTarget {
                      ~~~~~~~~~~~
    'AbortSignal' was also declared here.

node_modules/@types/react-native/globals.d.ts:400:15 - error TS2300: Duplicate identifier 'AbortSignal'.

400 declare class AbortSignal implements EventTarget {
                  ~~~~~~~~~~~

  node_modules/@types/node/globals.d.ts:60:11
    60 interface AbortSignal {
                 ~~~~~~~~~~~
    'AbortSignal' was also declared here.
  node_modules/@types/node/globals.d.ts:72:13
    72 declare var AbortSignal: {
                   ~~~~~~~~~~~
    and here.

node_modules/@types/react-native/globals.d.ts:435:15 - error TS2300: Duplicate identifier 'AbortController'.

435 declare class AbortController {
                  ~~~~~~~~~~~~~~~

  node_modules/@types/node/globals.d.ts:47:11
    47 interface AbortController {
                 ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.
  node_modules/@types/node/globals.d.ts:67:13
    67 declare var AbortController: {
                   ~~~~~~~~~~~~~~~
    and here.

Setting skipLibCheck to true avoids duplication errors and also save time during compilation

when running `tsc` on a project inited with this template (v6.9.0), the following errors are thrown:

```
node_modules/@types/node/globals.d.ts:47:11 - error TS2300: Duplicate identifier 'AbortController'.

47 interface AbortController {
             ~~~~~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:435:15
    435 declare class AbortController {
                      ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.

node_modules/@types/node/globals.d.ts:60:11 - error TS2300: Duplicate identifier 'AbortSignal'.

60 interface AbortSignal {
             ~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:400:15
    400 declare class AbortSignal implements EventTarget {
                      ~~~~~~~~~~~
    'AbortSignal' was also declared here.

node_modules/@types/node/globals.d.ts:67:13 - error TS2300: Duplicate identifier 'AbortController'.

67 declare var AbortController: {
               ~~~~~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:435:15
    435 declare class AbortController {
                      ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.

node_modules/@types/node/globals.d.ts:72:13 - error TS2300: Duplicate identifier 'AbortSignal'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  node_modules/@types/react-native/globals.d.ts:400:15
    400 declare class AbortSignal implements EventTarget {
                      ~~~~~~~~~~~
    'AbortSignal' was also declared here.

node_modules/@types/react-native/globals.d.ts:400:15 - error TS2300: Duplicate identifier 'AbortSignal'.

400 declare class AbortSignal implements EventTarget {
                  ~~~~~~~~~~~

  node_modules/@types/node/globals.d.ts:60:11
    60 interface AbortSignal {
                 ~~~~~~~~~~~
    'AbortSignal' was also declared here.
  node_modules/@types/node/globals.d.ts:72:13
    72 declare var AbortSignal: {
                   ~~~~~~~~~~~
    and here.

node_modules/@types/react-native/globals.d.ts:435:15 - error TS2300: Duplicate identifier 'AbortController'.

435 declare class AbortController {
                  ~~~~~~~~~~~~~~~

  node_modules/@types/node/globals.d.ts:47:11
    47 interface AbortController {
                 ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.
  node_modules/@types/node/globals.d.ts:67:13
    67 declare var AbortController: {
                   ~~~~~~~~~~~~~~~
    and here.
```

Setting [skipLibCheck](https://www.typescriptlang.org/tsconfig#skipLibCheck) to true avoids duplication errors and also save time during compilation
@sbalay sbalay requested review from emin93 and radko93 as code owners January 30, 2022 14:34
@emin93

emin93 commented Jan 31, 2022

Copy link
Copy Markdown
Member

The issue is that there are duplicate declarations in @types/node and @types/react-native (#203). skipLibCheck has already been set to true before but that was changed in #182.

Since the issue is already open for a while already, I am going to approve this one and we can set it back to false when the underlying issue is solved.

@emin93 emin93 merged commit 8c35573 into react-native-community:main Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants