polkadot-js/api

View on GitHub
packages/types/src/create/createClass.ts

Summary

Maintainability
A
0 mins
Test Coverage
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { Codec, CodecClass, Registry } from '@polkadot/types-codec/types';
import type { DetectCodec } from '../types/index.js';

import { createClassUnsafe } from '@polkadot/types-create';

export function createClass<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K): CodecClass<DetectCodec<T, K>> {
  return createClassUnsafe(registry, type);
}