utils icon indicating copy to clipboard operation
utils copied to clipboard

Add `Type` to `Keyring` as generic type parameter

Open mikesposito opened this issue 1 year ago • 2 comments

This PR adds the Type extends string generic type parameter to Keyring, making it Keyring<Type, String>. This will help to infer types coming from builders in KeyringController. In that regard, this PR also adds a KeyringBuilder type.

  • Related to https://github.com/MetaMask/core/issues/4366

mikesposito avatar Jun 04 '24 13:06 mikesposito

Converting to draft until I have another draft PR on KeyringController to show how this would help

mikesposito avatar Jun 04 '24 14:06 mikesposito

Nit: Would it make sense to use Kind (i.e. type of type) instead of Type here as the name of the generic parameter (and "kind" instead of "type" as the type property name), since we're trying to specify sub-categories of the Keyring type?

The term "type" is generally used for categories of values not types. Here's an example of "kind" being used in the TypeScript documentation.

MajorLift avatar Jun 06 '24 13:06 MajorLift

The Keyring type has been moved to the @metamask/keyring-utils package, and has been deprecated here in utils. I'm closing this and will reopen it in the new repo.

mikesposito avatar Mar 14 '25 11:03 mikesposito