macoolka-type-model
Version:
`macoolka-type-model` is a library for define model in TypeScript. It easily build a type contain field and method to your Application. It provide a generation model for type and validition
25 lines (24 loc) • 1.52 kB
TypeScript
import { Field, Entity, Card, Action, QueryForm, MutationForm, FieldElement, Element } from './Entity';
export * from './Entity';
export { MScalars, MBasicScalar } from '../models/Module';
export declare const isAction: (a: Element) => a is Action;
export declare const isCard: (a: Element) => a is Card;
export declare const isFieldElement: (a: Element) => a is FieldElement;
export declare const isMutationForm: (a: Element) => a is MutationForm;
export declare const isQueryForm: (a: Element) => a is QueryForm;
export declare const isField: (a: Element) => a is import("../models/InputModule").MField;
export declare type NameObject<K, A> = Record<string, A>;
export declare type FieldDict<K extends string> = Record<K, Field>;
export declare type CardDict<K extends string> = Record<K, Card>;
export declare type ActionDict<K extends string> = Record<K, Action>;
export declare type QueryFormDict<K extends string> = Record<K, QueryForm>;
export declare type FieldElementDict<K extends string> = Record<K, FieldElement>;
export declare type MutationFormDict<K extends string> = Record<K, MutationForm>;
export declare type EntityDict<F extends string, A extends string, E extends string, C extends string, FO extends string, M extends string> = Omit<Entity, 'fields' | 'actions' | 'cards' | 'mutations' | 'forms' | 'elements'> & {
fields: FieldDict<F>;
actions: ActionDict<A>;
cards: CardDict<C>;
mutations: MutationFormDict<M>;
forms: MutationFormDict<FO>;
elements: FieldElementDict<E>;
};