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

[Bug]: Missing dependencies causing TypeScript build failure in dependents #1140

Open
S0AndS0 opened this issue Nov 22, 2024 · 1 comment
Open

Comments

@S0AndS0
Copy link

S0AndS0 commented Nov 22, 2024

SDK

Web

Provide environment information

OS: Linux
IDE: Vim
Stage: TypeScript build fails for listed reasons

Howdy team! What follows are the configurations, commands, and resulting errors caused by attempting to install and use the MetaMask SDK in a new project. TLDR It seems as though @types/readable-stream, @types/react, and some unknown packages are missing from y'alls' package.json file. And any help on sorting out what the "unknown packages" be would be much appreciated.

MetaMask SDK Version

0.30.3

MetaMask Mobile app Version

N/A

What browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

N/A

Describe the Bug

Error from npm run ts-build

[USER@HOST PROJECT]$ npm run ts-build

> @ORG/[email protected] ts-build
> tsc --project tsconfig.json

node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts:3:29 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/USER/git/hub/ORG/PROJECT/node_modules/readable-stream/readable.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

3 import type { Duplex } from 'readable-stream';
                              ~~~~~~~~~~~~~~~~~

node_modules/@metamask/providers/dist/types/StreamProvider.d.ts:5:29 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/USER/git/hub/ORG/PROJECT/node_modules/readable-stream/readable.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

5 import type { Duplex } from 'readable-stream';
                              ~~~~~~~~~~~~~~~~~

node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts:2:29 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/USER/git/hub/ORG/PROJECT/node_modules/readable-stream/readable.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

2 import type { Duplex } from 'readable-stream';
                              ~~~~~~~~~~~~~~~~~

node_modules/@metamask/sdk/dist/types/src/provider/SDKProvider.d.ts:1:24 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/USER/git/hub/ORG/PROJECT/node_modules/readable-stream/readable.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

1 import { Duplex } from 'readable-stream';
                         ~~~~~~~~~~~~~~~~~

node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native-webview/index.d.ts:1:27 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

1 import { Component } from 'react';
                            ~~~~~~~

node_modules/react-native-webview/lib/WebViewTypes.d.ts:1:41 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

1 import { ReactElement, Component } from 'react';
                                          ~~~~~~~

node_modules/react-native-webview/lib/WebViewTypes.d.ts:2:85 - error TS2305: Module '"react-native"' has no exported member 'Constructor'.

2 import { NativeSyntheticEvent, ViewProps, StyleProp, ViewStyle, NativeMethodsMixin, Constructor, UIManagerStatic, NativeScrollEvent } from 'react-native';
                                                                                      ~~~~~~~~~~~

node_modules/react-native/Libraries/Animated/Animated.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Button.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts:108:31 - error TS2503: Cannot find namespace 'JSX'.

108   renderNavigationView: () => JSX.Element;
                                  ~~~

node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Pressable/Pressable.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/RefreshControl/RefreshControl.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/ScrollView/ScrollView.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/StatusBar/StatusBar.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Switch/Switch.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Touchable/Touchable.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Touchable/TouchableHighlight.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/View/View.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Components/View/ViewPropTypes.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Image/Image.d.ts:10:24 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import * as React from 'react';
                          ~~~~~~~

node_modules/react-native/Libraries/Lists/FlatList.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Lists/FlatList.d.ts:225:29 - error TS2503: Cannot find namespace 'JSX'.

225   getScrollResponder: () => JSX.Element | null | undefined;
                                ~~~

node_modules/react-native/Libraries/Lists/SectionList.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Modal/Modal.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/ReactNative/AppRegistry.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/ReactNative/RendererProxy.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/ReactNative/RootTag.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/ReactNative/UIManager.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Text/Text.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/Types/CoreEventTypes.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/Libraries/YellowBox/YellowBoxDeprecated.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/react-native/types/modules/globals.d.ts:78:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'Blob' must be of type '{ new (blobParts?: BlobPart[] | undefined, options?: BlobPropertyBag | undefined): Blob; prototype: Blob; }', but here has type '{ new (blobParts?: (string | Blob)[] | undefined, options?: BlobOptions | undefined): Blob; prototype: Blob; }'.

78 declare var Blob: {
               ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2571:13
    2571 declare var Blob: {
                     ~~~~
    'Blob' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:84:3 - error TS2687: All declarations of 'name' must have identical modifiers.

84   name: string;
     ~~~~

node_modules/react-native/types/modules/globals.d.ts:85:3 - error TS2687: All declarations of 'lastModified' must have identical modifiers.

85   lastModified: number;
     ~~~~~~~~~~~~

node_modules/react-native/types/modules/globals.d.ts:88:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'File' must be of type '{ new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag | undefined): File; prototype: File; }', but here has type '{ new (fileParts?: (string | Blob)[] | undefined, name?: string | undefined, options?: BlobOptions | undefined): File; prototype: File; }'.

88 declare var File: {
               ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5340:13
    5340 declare var File: {
                     ~~~~
    'File' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:113:15 - error TS2300: Duplicate identifier 'FormData'.

113 declare class FormData {
                  ~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5562:11
    5562 interface FormData {
                   ~~~~~~~~
    'FormData' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:5572:13
    5572 declare var FormData: {
                     ~~~~~~~~
    and here.
  node_modules/typescript/lib/lib.dom.iterable.d.ts:86:11
    86 interface FormData {
                 ~~~~~~~~
    and here.

node_modules/react-native/types/modules/globals.d.ts:141:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'Headers' must be of type '{ new (init?: HeadersInit | undefined): Headers; prototype: Headers; }', but here has type '{ new (init?: HeadersInit_ | undefined): Headers; prototype: Headers; }'.

141 declare var Headers: {
                ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:8600:13
    8600 declare var Headers: {
                     ~~~~~~~
    'Headers' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:175:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'body' must be of type 'BodyInit | null | undefined', but here has type 'BodyInit_ | undefined.

175   body?: BodyInit_ | undefined;
      ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:1591:5
    1591     body?: BodyInit | null;
             ~~~~
    'body' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:177:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'headers' must be of type 'HeadersInit | undefined', but here has type 'HeadersInit_ | undefined.

177   headers?: HeadersInit_ | undefined;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:1597:5
    1597     headers?: HeadersInit;
             ~~~~~~~
    'headers' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:183:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'window' must be of type 'null | undefined', but here has type 'any'.

183   window?: any | undefined;
      ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:1615:5
    1615     window?: null;
             ~~~~~~
    'window' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:184:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'signal' must be of type 'AbortSignal | null | undefined', but here has type 'AbortSignal | undefined.

184   signal?: AbortSignal | undefined;
      ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:1613:5
    1613     signal?: AbortSignal | null;
             ~~~~~~
    'signal' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:194:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'signal' must be of type 'AbortSignal', but here has type 'AbortSignal | undefined'.

194   readonly signal: AbortSignal | undefined;
               ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:11725:14
    11725     readonly signal: AbortSignal;
                       ~~~~~~
    'signal' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:198:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'Request' must be of type '{ new (input: RequestInfo | URL, init?: RequestInit | undefined): Request; prototype: Request; }', but here has type '{ new (input: string | Request, init?: RequestInit | undefined): Request; prototype: Request; }'.

198 declare var Request: {
                ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:11731:13
    11731 declare var Request: {
                      ~~~~~~~
    'Request' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:203:14 - error TS2300: Duplicate identifier 'RequestInfo'.

203 declare type RequestInfo = Request | string;
                 ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:18345:6
    18345 type RequestInfo = Request | string;
               ~~~~~~~~~~~
    'RequestInfo' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:206:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'headers' must be of type 'HeadersInit | undefined', but here has type 'HeadersInit_ | undefined'
.

206   headers?: HeadersInit_ | undefined;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:1623:5
    1623     headers?: HeadersInit;
             ~~~~~~~
    'headers' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:222:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'Response' must be of type '{ new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): Response; prototype: Response; error(): Response; redirect(url: string | URL, status?: number | undefined): Response; }', but here has type '{ new (body?: BodyInit_ | undefined, init?: ResponseInit | undefined): Response; prototype : Response; error: () => Response; redirect: (url: string, status?: number | undefined) => Response; }'.

222 declare var Response: {
                ~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:11782:13
    11782 declare var Response: {
                      ~~~~~~~~
    'Response' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:284:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'DONE' must be of type 'number', but here has type '4'.

284   readonly DONE: 4;
               ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17165:14
    17165     readonly DONE: number;
                       ~~~~
    'DONE' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:285:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'HEADERS_RECEIVED' must be of type 'number', but here has type '2'.

285   readonly HEADERS_RECEIVED: 2;
               ~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17166:14
    17166     readonly HEADERS_RECEIVED: number;
                       ~~~~~~~~~~~~~~~~
    'HEADERS_RECEIVED' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:286:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'LOADING' must be of type 'number', but here has type '3'.

286   readonly LOADING: 3;
               ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17167:14
    17167     readonly LOADING: number;
                       ~~~~~~~
    'LOADING' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:287:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'OPENED' must be of type 'number', but here has type '1'.

287   readonly OPENED: 1;
               ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17168:14
    17168     readonly OPENED: number;
                       ~~~~~~
    'OPENED' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:288:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'UNSENT' must be of type 'number', but here has type '0'.

288   readonly UNSENT: 0;
               ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17169:14
    17169     readonly UNSENT: number;
                       ~~~~~~
    'UNSENT' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:301:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'XMLHttpRequest' must be of type '{ new (): XMLHttpRequest; prototype: XMLHttpRequest; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; }', but here has type '{ new (): XMLHttpRequest; prototype: XMLHttpRequest; readonly DONE: 4; readonly HEADERS_RECEIVED: 2; readonly LOADING: 3; readonly OPENED: 1; readonly UNSENT: 0; }'.

301 declare var XMLHttpRequest: {
                ~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17176:13
    17176 declare var XMLHttpRequest: {
                      ~~~~~~~~~~~~~~
    'XMLHttpRequest' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:312:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'abort' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEv
ent<EventTarget>'.

312   abort: ProgressEvent;
      ~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17187:5
    17187     "abort": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~
    'abort' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:313:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'error' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEv
ent<EventTarget>'.

313   error: ProgressEvent;
      ~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17188:5
    17188     "error": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~
    'error' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:314:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'load' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEvent<EventTarget>'.

314   load: ProgressEvent;
      ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17189:5
    17189     "load": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~
    'load' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:315:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'loadend' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEvent<EventTarget>'.

315   loadend: ProgressEvent;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17190:5
    17190     "loadend": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~~~
    'loadend' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:316:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'loadstart' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEvent<EventTarget>'.

316   loadstart: ProgressEvent;
      ~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17191:5
    17191     "loadstart": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~~~~~
    'loadstart' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:317:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'progress' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEvent<EventTarget>'.

317   progress: ProgressEvent;
      ~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17192:5
    17192     "progress": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~~~~
    'progress' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:318:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'timeout' must be of type 'ProgressEvent<XMLHttpRequestEventTarget>', but here has type 'ProgressEvent<EventTarget>'.

318   timeout: ProgressEvent;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:17193:5
    17193     "timeout": ProgressEvent<XMLHttpRequestEventTarget>;
              ~~~~~~~~~
    'timeout' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:371:14 - error TS2300: Duplicate identifier 'XMLHttpRequestResponseType'.

371 declare type XMLHttpRequestResponseType =
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:18505:6
    18505 type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
               ~~~~~~~~~~~~~~~~~~~~~~~~~~
    'XMLHttpRequestResponseType' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:384:15 - error TS2300: Duplicate identifier 'URL'.

384 declare class URL {
                  ~~~

  node_modules/typescript/lib/lib.dom.d.ts:14499:11
    14499 interface URL {
                    ~~~
    'URL' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:14516:13
    14516 declare var URL: {
                      ~~~
    and here.

node_modules/react-native/types/modules/globals.d.ts:409:15 - error TS2300: Duplicate identifier 'URLSearchParams'.

409 declare class URLSearchParams {
                  ~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:14526:11
    14526 interface URLSearchParams {
                    ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:14545:13
    14545 declare var URLSearchParams: {
                      ~~~~~~~~~~~~~~~
    and here.
  node_modules/typescript/lib/lib.dom.iterable.d.ts:263:11
    263 interface URLSearchParams {
                  ~~~~~~~~~~~~~~~
    and here.

node_modules/react-native/types/modules/globals.d.ts:468:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'onopen' must be of type '((this: WebSocket, ev: Event) => any) | null', but here has type '(() => void) | null'.

468   onopen: (() => void) | null;
      ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16721:5
    16721     onopen: ((this: WebSocket, ev: Event) => any) | null;
              ~~~~~~
    'onopen' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:469:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'onmessage' must be of type '((this: WebSocket, ev: MessageEvent<any>) => any) | null', but here has type '((event: WebSocketMessageEvent) => void) | null'.

469   onmessage: ((event: WebSocketMessageEvent) => void) | null;
      ~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16720:5
    16720     onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null;
              ~~~~~~~~~
    'onmessage' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:470:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'onerror' must be of type '((this: WebSocket, ev: Event) => any) | null', but here has type '((event: WebSocketErrorEvent) => void) | null'.

470   onerror: ((event: WebSocketErrorEvent) => void) | null;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16719:5
    16719     onerror: ((this: WebSocket, ev: Event) => any) | null;
              ~~~~~~~
    'onerror' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:471:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'onclose' must be of type '((this: WebSocket, ev: CloseEvent) => any) | null', but here has type '((event: WebSocketCloseEvent) => void) | null'.

471   onclose: ((event: WebSocketCloseEvent) => void) | null;
      ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16718:5
    16718     onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
              ~~~~~~~
    'onclose' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:472:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'addEventListener' must be of type '{ <K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | ... 1 more ... | undefined): void; }', but here
 has type 'WebsocketEventListener'.

472   addEventListener: WebsocketEventListener;
      ~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16736:5
    16736     addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'addEventListener' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:473:3 - error TS2717: Subsequent property declarations must have the same type.  Property 'removeEventListener' must be of type '{ <K extends keyof WebSocketEventMap>(type: K, listener: ( this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | ... 1 more ... | undefined): void; }', but here has type 'WebsocketEventListener'.

473   removeEventListener: WebsocketEventListener;
      ~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16738:5
    16738     removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'removeEventListener' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:476:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'WebSocket' must be of type '{ new (url: string | URL, protocols?: string | string[] | undefined): WebSocket; prototype: WebSocket; readonly CLOSED: number; readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; }', but here has type '{ new (uri: string, protocols?: string | string[] | null | undefined, options?  : { [optionName: string]: any; headers: { [headerName: string]: string; }; } | null | undefined): WebSocket; ... 4 more ...; readonly OPEN: number; }'.

476 declare var WebSocket: {
                ~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:16742:13
    16742 declare var WebSocket: {
                      ~~~~~~~~~
    'WebSocket' was also declared here.

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

500 declare class AbortSignal implements EventTarget {
                  ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2059:11
    2059 interface AbortSignal extends EventTarget {
                   ~~~~~~~~~~~
    'AbortSignal' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:2071:13
    2071 declare var AbortSignal: {
                     ~~~~~~~~~~~
    and here.

node_modules/react-native/types/modules/globals.d.ts:500:15 - error TS2420: Class 'AbortSignal' incorrectly implements interface 'EventTarget'.
  Property 'dispatchEvent' is missing in type 'AbortSignal' but required in type 'EventTarget'.

500 declare class AbortSignal implements EventTarget {
                  ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5309:5
    5309     dispatchEvent(event: Event): boolean;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'dispatchEvent' is declared here.

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

535 declare class AbortController {
                  ~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2042:11
    2042 interface AbortController {
                   ~~~~~~~~~~~~~~~
    'AbortController' was also declared here.
  node_modules/typescript/lib/lib.dom.d.ts:2049:13
    2049 declare var AbortController: {
                     ~~~~~~~~~~~~~~~
    and here.

node_modules/react-native/types/modules/globals.d.ts:560:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'error' must be of type 'DOMException | null', but here has type 'Error | null'.

560   readonly error: Error | null;
               ~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5368:14
    5368     readonly error: DOMException | null;
                      ~~~~~
    'error' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:570:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'result' must be of type 'string | ArrayBuffer | null', but here has type 'string | ArrayBuffer'
.

570   readonly result: string | ArrayBuffer;
               ~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5376:14
    5376     readonly result: string | ArrayBuffer | null;
                      ~~~~~~
    'result' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:576:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'DONE' must be of type 'number', but here has type '2'.

576   readonly DONE: 2;
               ~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5382:14
    5382     readonly DONE: number;
                      ~~~~
    'DONE' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:577:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'EMPTY' must be of type 'number', but here has type '0'.

577   readonly EMPTY: 0;
               ~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5383:14
    5383     readonly EMPTY: number;
                      ~~~~~
    'EMPTY' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:578:12 - error TS2717: Subsequent property declarations must have the same type.  Property 'LOADING' must be of type 'number', but here has type '1'.

578   readonly LOADING: 1;
               ~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5384:14
    5384     readonly LOADING: number;
                      ~~~~~~~
    'LOADING' was also declared here.

node_modules/react-native/types/modules/globals.d.ts:593:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'FileReader' must be of type '{ new (): FileReader; prototype: FileReader; readonly DONE: number; readonly EMPTY: number; readonly LOADING: number; }', but here has type '{ new (): FileReader; prototype: FileReader; readonly DONE: 2; readonly EMPTY: 0; readonly LOADING: 1; }'.

593 declare var FileReader: {
                ~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:5391:13
    5391 declare var FileReader: {
                     ~~~~~~~~~~
    'FileReader' was also declared here.

node_modules/react-native/types/public/ReactNativeTypes.d.ts:10:29 - error TS7016: Could not find a declaration file for module 'react'. '/home/USER/git/hub/ORG/PROJECT/node_modules/react/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react` if it exists or add a new declaration (.d.ts) file containing `declare module 'react';`

10 import type * as React from 'react';
                               ~~~~~~~

node_modules/typescript/lib/lib.dom.d.ts:2042:11 - error TS2300: Duplicate identifier 'AbortController'.

2042 interface AbortController {
               ~~~~~~~~~~~~~~~

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

node_modules/typescript/lib/lib.dom.d.ts:2049:13 - error TS2300: Duplicate identifier 'AbortController'.

2049 declare var AbortController: {
                 ~~~~~~~~~~~~~~~

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

node_modules/typescript/lib/lib.dom.d.ts:2059:11 - error TS2300: Duplicate identifier 'AbortSignal'.

2059 interface AbortSignal extends EventTarget {
               ~~~~~~~~~~~

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

node_modules/typescript/lib/lib.dom.d.ts:2071:13 - error TS2300: Duplicate identifier 'AbortSignal'.

2071 declare var AbortSignal: {
                 ~~~~~~~~~~~

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

node_modules/typescript/lib/lib.dom.d.ts:5335:14 - error TS2687: All declarations of 'lastModified' must have identical modifiers.

5335     readonly lastModified: number;
                  ~~~~~~~~~~~~

node_modules/typescript/lib/lib.dom.d.ts:5336:14 - error TS2687: All declarations of 'name' must have identical modifiers.

5336     readonly name: string;
                  ~~~~

node_modules/typescript/lib/lib.dom.d.ts:5562:11 - error TS2300: Duplicate identifier 'FormData'.

5562 interface FormData {
               ~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:113:15
    113 declare class FormData {
                      ~~~~~~~~
    'FormData' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:5572:13 - error TS2300: Duplicate identifier 'FormData'.

5572 declare var FormData: {
                 ~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:113:15
    113 declare class FormData {
                      ~~~~~~~~
    'FormData' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:14499:11 - error TS2300: Duplicate identifier 'URL'.

14499 interface URL {
                ~~~

  node_modules/react-native/types/modules/globals.d.ts:384:15
    384 declare class URL {
                      ~~~
    'URL' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:14516:13 - error TS2300: Duplicate identifier 'URL'.

14516 declare var URL: {
                  ~~~

  node_modules/react-native/types/modules/globals.d.ts:384:15
    384 declare class URL {
                      ~~~
    'URL' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:14526:11 - error TS2300: Duplicate identifier 'URLSearchParams'.

14526 interface URLSearchParams {
                ~~~~~~~~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:409:15
    409 declare class URLSearchParams {
                      ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:14545:13 - error TS2300: Duplicate identifier 'URLSearchParams'.

14545 declare var URLSearchParams: {
                  ~~~~~~~~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:409:15
    409 declare class URLSearchParams {
                      ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:18345:6 - error TS2300: Duplicate identifier 'RequestInfo'.

18345 type RequestInfo = Request | string;
           ~~~~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:203:14
    203 declare type RequestInfo = Request | string;
                     ~~~~~~~~~~~
    'RequestInfo' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:18505:6 - error TS2300: Duplicate identifier 'XMLHttpRequestResponseType'.

18505 type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
           ~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:371:14
    371 declare type XMLHttpRequestResponseType =
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~
    'XMLHttpRequestResponseType' was also declared here.

node_modules/typescript/lib/lib.dom.iterable.d.ts:86:11 - error TS2300: Duplicate identifier 'FormData'.

86 interface FormData {
             ~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:113:15
    113 declare class FormData {
                      ~~~~~~~~
    'FormData' was also declared here.

node_modules/typescript/lib/lib.dom.iterable.d.ts:263:11 - error TS2300: Duplicate identifier 'URLSearchParams'.

263 interface URLSearchParams {
              ~~~~~~~~~~~~~~~

  node_modules/react-native/types/modules/globals.d.ts:409:15
    409 declare class URLSearchParams {
                      ~~~~~~~~~~~~~~~
    'URLSearchParams' was also declared here.


Found 107 errors in 44 files.

Errors  Files
     1  node_modules/@metamask/providers/dist/types/MetaMaskInpageProvider.d.ts:3
     1  node_modules/@metamask/providers/dist/types/StreamProvider.d.ts:5
     1  node_modules/@metamask/providers/dist/types/initializeInpageProvider.d.ts:2
     1  node_modules/@metamask/sdk/dist/types/src/provider/SDKProvider.d.ts:1
     1  node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.d.ts:10
     1  node_modules/react-native-webview/index.d.ts:1
     2  node_modules/react-native-webview/lib/WebViewTypes.d.ts:1
     1  node_modules/react-native/Libraries/Animated/Animated.d.ts:10
     1  node_modules/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts:10
     1  node_modules/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts:10
     1  node_modules/react-native/Libraries/Components/Button.d.ts:10
     2  node_modules/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts:10
     1  node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts:10
     1  node_modules/react-native/Libraries/Components/Pressable/Pressable.d.ts:10
     1  node_modules/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts:10
     1  node_modules/react-native/Libraries/Components/RefreshControl/RefreshControl.d.ts:10
     1  node_modules/react-native/Libraries/Components/SafeAreaView/SafeAreaView.d.ts:10
     1  node_modules/react-native/Libraries/Components/ScrollView/ScrollView.d.ts:10
     1  node_modules/react-native/Libraries/Components/StatusBar/StatusBar.d.ts:10
     1  node_modules/react-native/Libraries/Components/Switch/Switch.d.ts:10
     1  node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.d.ts:10
     1  node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts:10
     1  node_modules/react-native/Libraries/Components/Touchable/Touchable.d.ts:10
     1  node_modules/react-native/Libraries/Components/Touchable/TouchableHighlight.d.ts:10
     1  node_modules/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts:10
     1  node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts:10
     1  node_modules/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts:10
     1  node_modules/react-native/Libraries/Components/View/View.d.ts:10
     1  node_modules/react-native/Libraries/Components/View/ViewPropTypes.d.ts:10
     1  node_modules/react-native/Libraries/Image/Image.d.ts:10
     2  node_modules/react-native/Libraries/Lists/FlatList.d.ts:10
     1  node_modules/react-native/Libraries/Lists/SectionList.d.ts:10
     1  node_modules/react-native/Libraries/Modal/Modal.d.ts:10
     1  node_modules/react-native/Libraries/ReactNative/AppRegistry.d.ts:10
     1  node_modules/react-native/Libraries/ReactNative/RendererProxy.d.ts:10
     1  node_modules/react-native/Libraries/ReactNative/RootTag.d.ts:10
     1  node_modules/react-native/Libraries/ReactNative/UIManager.d.ts:10
     1  node_modules/react-native/Libraries/Text/Text.d.ts:10
     1  node_modules/react-native/Libraries/Types/CoreEventTypes.d.ts:10
     1  node_modules/react-native/Libraries/YellowBox/YellowBoxDeprecated.d.ts:10
    47  node_modules/react-native/types/modules/globals.d.ts:78
     1  node_modules/react-native/types/public/ReactNativeTypes.d.ts:10
    14  node_modules/typescript/lib/lib.dom.d.ts:2042
     2  node_modules/typescript/lib/lib.dom.iterable.d.ts:86

Installing suggested packages

npm i --save-dev @types/readable-stream
npm i --save-dev @types/react

Updated package.json

{
  "name": "@ORG/PROJECT",
  "version": "0.0.1",
  "description": "Example of authenticating a Dapp with MetaMask",
  "main": "index.js",
  "scripts": {
    "ts-build": "tsc --project tsconfig.json",
    "ts-watch": "tsc --project tsconfig.json --watch",
    "ts-lint": "npx eslint ts/assets --ext .ts,.tsx",
    "js-lint": "npx eslint ts/assets --ext .js,.jsx",
    "py-serve": "python3 -m http.server --bind 127.0.0.1 8080"
  },
  "repository": {
    "type": "git",
    "url": "git+ssh://[email protected]/ORG/PROJECT.git"
  },
  "keywords": [
    "metamask",
    "dapp"
  ],
  "author": "S0AndS0",
  "license": "AGPL-3.0",
  "bugs": {
    "url": "https://github.com/ORG/PROJECT/issues"
  },
  "homepage": "https://github.com/ORG/PROJECT#readme",
  "devDependencies": {
    "@metamask/sdk": "^0.30.3",
    "@types/react": "^18.3.12",
    "@types/readable-stream": "^4.0.18",
    "typescript": "^4.1.2"
  }
}

Errors, though less, persist with npm run ts-build

Expected Behavior

Expect npm run ts-build to build (transpile) TypeScript into JavaScript

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

Initial package.json

{
  "name": "@ORG/PROJECT",
  "version": "0.0.1",
  "description": "Example of authenticating a Dapp with MetaMask",
  "main": "index.js",
  "scripts": {
    "ts-build": "tsc --project tsconfig.json",
    "ts-watch": "tsc --project tsconfig.json --watch",
    "ts-lint": "npx eslint ts/assets --ext .ts,.tsx",
    "js-lint": "npx eslint ts/assets --ext .js,.jsx",
    "py-serve": "python3 -m http.server --bind 127.0.0.1 8080"
  },
  "repository": {
    "type": "git",
    "url": "git+ssh://[email protected]/ORG/PROJECT.git"
  },
  "keywords": [
    "metamask"
  ],
  "author": "S0AndS0",
  "license": "AGPL-3.0",
  "bugs": {
    "url": "https://github.com/ORG/PROJECT/issues"
  },
  "homepage": "https://github.com/ORG/PROJECT#readme",
  "devDependencies": {
    "@metamask/sdk": "^0.30.3",
    "typescript": "^4.1.2"
  }
}

Write a TypeScript file that imports types from MetaMask

"use strict";

import type MetaMaskSDK from '@metamask/sdk';

/**
 * @file
 * @author S0AndS0
 * @license AGPL-3.0
 */

const memory_storage: {
  [key: string]: unknown;
  accounts?: string[];
} = {
  accounts: undefined,
};


window.addEventListener("load", (_event) => {
  const button__authenticate_metamask = document.getElementById(
    "button__authenticate_metamask"
  ) as HTMLButtonElement;

  const button__sign_text = document.getElementById(
    "button__sign_text"
  ) as HTMLButtonElement;

  const textarea__input = document.getElementById(
    "textarea__input"
  ) as HTMLTextAreaElement;

  const textarea__output = document.getElementById(
    "textarea__output"
  ) as HTMLTextAreaElement;

  //
  button__authenticate_metamask.addEventListener("click", (event) => {
    event.preventDefault();
    window.ethereum?.request<string[]>({
        method: "eth_requestAccounts",
      }).catch((error) => {
        console.error('eth_requestAccounts error ->', error);
        throw error;
      })
      .then((accounts) => {
        if (typeof accounts !== 'object') {
          throw new TypeError(`Object Array expected but got -> ${typeof accounts}`);
        } else if (!accounts || Object.keys(accounts).length) {
          throw new Error('Empty accounts list');
        }

        memory_storage.accounts = accounts as string[];
        console.log('eth_requestAccounts saved accounts ->', {memory_storage});
      });
  });

  //
  button__sign_text.addEventListener("click", (event) => {
    if (!textarea__input.value.length) {
      throw new Error("No message provided to sign");
    } else if (
      memory_storage.accounts === undefined ||
      !memory_storage.accounts.length
    ) {
      throw new Error("No accounts found");
    }

    window.ethereum
      ?.request<string>({
        method: "personal_sign",
      })
      .then((result) => {
        if (typeof result !== 'string') {
          throw new Error()
        }
        textarea__output.value = result;
      });
  });
});

// vim: expandtab

Run npm run ts-build as prescribed

@S0AndS0
Copy link
Author

S0AndS0 commented Nov 22, 2024

Update; after installing suggested dependencies I got rid of remaining errors by adding "skipLibCheck": true to my tsconfig.json file!!!

Example patch

 {
   "compilerOptions": {
     "outFile": "./assets/js/main.js",
     "target": "es2019",
     "module": "AMD",
     "lib": ["DOM", "DOM.Iterable", "es2019"],
     "moduleResolution": "node",
     "sourceMap": true,
     "strictBindCallApply": true,
     "strictFunctionTypes": true,
     "strictNullChecks": true,
     "strictPropertyInitialization": true,
     "noImplicitAny": true,
     "removeComments": true,
-    "experimentalDecorators": false
+    "experimentalDecorators": false,
+    "skipLibCheck": true
   },
   "include": ["src/assets/js/**/*.ts", "./@types"],
   "exclude": ["node_modules"]
 }

... This likely means this Issue can be resolved once the TLDR packages are added to y'alls' dependencies.

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

No branches or pull requests

1 participant