export interface TUnion { type: 'union'; title: 'union'; list: TType[]; } export declare const tUnion: (list: TType[]) => TUnion; export interface TArray<_Ele extends TType = TType> { type: 'array'; ele: TType; title: 'array'; } export declare const tArray: (ele: T) => TArray; export declare const isTArray: (type: TType) => type is TArray; export type TTypeVar = { type: 'typeVar'; title: 'typeVar'; name: string; bound: TType; }; export declare const tTypeVar: (name: string, bound: TType) => TTypeVar; export type TTypeRef = { type: 'typeRef'; title: 'typeRef'; name: string; }; export declare const tTypeRef: (name: string) => TTypeRef; export type TFunction = { type: 'function'; title: 'function'; typeVars: TTypeVar[]; args: TType[]; rt: TType; }; export declare const tFunction: (fn: { typeVars?: TTypeVar[]; args: TType[]; rt: TType; }) => TFunction; export type TType = TDataType | TArray | TUnion | TTypeRef | TFunction; export type DataTypeShape = Record; export type TDataType> = { type: 'data'; name: string; data?: Data; }; export type ValueOfData = T extends DataDefine ? R : never; export type TypeOfData = T extends DataDefine ? TDataType : never; export declare class DataDefine> { private config; private dataMap; constructor(config: DataDefineConfig, dataMap: Map); create(data?: Data): TDataType; is(data: TType): data is TDataType; private isByName; isSubOf(superType: TDataType): boolean; private isSubOfByName; isSuperOf(subType: TDataType): boolean; } interface DataDefineConfig<_T extends DataTypeShape> { name: string; supers: DataDefine[]; } export declare class Typesystem { dataMap: Map>>; defineData(config: DataDefineConfig): DataDefine; isDataType(t: TType): t is TDataType; isSubtype(superType: TType, sub: TType, context?: Record): boolean; subst(context: Record, template: TFunction): TFunction; instance(context: Record, realArgs: TType[], realRt: TType, template: TFunction): TFunction; } export declare const typesystem: Typesystem; export declare const tUnknown: DataDefine>; export {}; //# sourceMappingURL=typesystem.d.ts.map