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 Report: TypeScript Issues in toSigner Function #125

Open
1 task done
joepegler opened this issue Nov 24, 2024 · 0 comments
Open
1 task done

🐛 Bug Report: TypeScript Issues in toSigner Function #125

joepegler opened this issue Nov 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@joepegler
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.1.10

Current Behavior

  1. TypeScript shows errors in IDE when passing window.ethereum as a signer to toSigner function
  2. signTypedData requires any type casting to work
  3. EthereumProvider type definition is incomplete and doesn't properly match window.ethereum's shape
  4. Type guards are insufficient for proper type narrowing

Expected Behavior

  1. window.ethereum should be accepted as a valid signer type without TypeScript errors
  2. signTypedData should work without any type casting
  3. EthereumProvider type should accurately reflect the shape of window.ethereum
  4. Type guards should properly narrow types for all possible signer variants

Steps To Reproduce

  1. Import and use toSigner in a browser environment:
  2. Observe TypeScript errors in IDE indicating type incompatibility
  3. Check signTypedData implementation:

Package.json (or lockfile) content

No response

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

No response

Anything else?

Related Files

  • src/sdk/account/utils/toSigner.ts
  • src/sdk/account/types.ts

Impact

  • Developers need to use type assertions
  • IDE support is compromised
  • Type safety is reduced
  • Poor developer experience

Workarounds

Currently, developers are forced to:

  1. Use type assertions (as any)
  2. Ignore TypeScript errors
  3. Create intermediate variables with explicit typing
@joepegler joepegler added bug Something isn't working help wanted Extra attention is needed labels Nov 24, 2024
@joepegler joepegler self-assigned this Nov 24, 2024
@joepegler joepegler changed the title # 🐛 Bug Report: TypeScript Issues in toSigner Function 🐛 Bug Report: TypeScript Issues in toSigner Function Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant