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

fix BaseProvider._handleChainChanged typing from inheritance #408

Closed
wants to merge 1 commit into from

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented Feb 3, 2025

Fixes the following error in main on yarn build

src/BaseProvider.ts:262:32 - error TS2379: Argument of type '{ chainId: string; networkVersion: string | undefined; isConnected: boolean | undefined; }' is not assignable to parameter of type '{ chainId?: string; networkVersion?: string | undefined; isConnected?: boolean; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  Types of property 'isConnected' are incompatible.
    Type 'boolean | undefined' is not assignable to type 'boolean'.
      Type 'undefined' is not assignable to type 'boolean'.

262       this._handleChainChanged({ chainId, networkVersion, isConnected });
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/MetaMaskInpageProvider.ts:475:31 - error TS2379: Argument of type '{ chainId: string | undefined; networkVersion: string | undefined; isConnected: boolean | undefined; }' is not assignable to parameter of type '{ chainId?: string; networkVersion?: string | undefined; isConnected?: boolean; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  Types of property 'chainId' are incompatible.
    Type 'string | undefined' is not assignable to type 'string'.
      Type 'undefined' is not assignable to type 'string'.

475     super._handleChainChanged({ chainId, networkVersion, isConnected });
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/StreamProvider.ts:180:31 - error TS2379: Argument of type '{ chainId: string; isConnected: boolean | undefined; }' is not assignable to parameter of type '{ chainId?: string; networkVersion?: string | undefined; isConnected?: boolean; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
  Types of property 'isConnected' are incompatible.
    Type 'boolean | undefined' is not assignable to type 'boolean'.
      Type 'undefined' is not assignable to type 'boolean'.

180     super._handleChainChanged({ chainId, isConnected });
                                  ~~~~~~~~~~~~~~~~~~~~~~~~

@jiexi jiexi requested a review from a team as a code owner February 3, 2025 18:36
@jiexi
Copy link
Contributor Author

jiexi commented Feb 3, 2025

nevermind. my mistake

@jiexi jiexi closed this Feb 3, 2025
@jiexi jiexi deleted the jl/fix-_handleChainChanged-typing branch February 3, 2025 18:40
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.

1 participant