"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createClass = createClass;
exports.ClassOfUnsafe = ClassOfUnsafe;
exports.ClassOf = ClassOf;

var _getTypeClass = require("./getTypeClass");

var _getTypeDef = require("./getTypeDef");

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
function createClass(type) {
  return (0, _getTypeClass.getTypeClass)((0, _getTypeDef.getTypeDef)(type));
} // An unsafe version of the `createType` below. It's unsafe because the `type`
// argument here can be any string, which, if not parseable, will yield a
// runtime error.


function ClassOfUnsafe(name) {
  return createClass(name);
} // alias for createClass


function ClassOf(name) {
  // TS2589: Type instantiation is excessively deep and possibly infinite.
  // The above happens with as Constructor<InterfaceRegistry[K]>;
  return ClassOfUnsafe(name);
}