Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Make `KnownCaipNamespacedChainId` type generic over `Namespace` type parameter ([#262](https://github.com/MetaMask/utils/pull/262))

## [11.5.0]

### Added
Expand Down
6 changes: 5 additions & 1 deletion src/caip-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ export enum KnownCaipNamespace {
*
* This is a narrower, more type-safe alternative to {@link CaipChainId} for use cases
* where the chain namespace must be one of the known standards.
*
* @template Namespace - The namespace of the CAIP-2 chain ID. Must be a known namespace specified in {@link KnownCaipNamespace}.
*/
export type KnownCaipNamespacedChainId = `${KnownCaipNamespace}:${string}`;
export type KnownCaipNamespacedChainId<
Namespace extends `${KnownCaipNamespace}` = `${KnownCaipNamespace}`,
> = `${Namespace}:${string}`;

/**
* Check if the given value is a {@link CaipChainId}.
Expand Down
Loading