0.1.6•Updated a month ago
declare namespace Entity {
namespace Meta {
type Config = Record<string, Type.Names>;
type Types = string | number | boolean;
type InferMetaType<TypeName extends Type.Names> =
TypeName extends "text" ? string
: TypeName extends "int" ? number
: TypeName extends "real" ? number
: TypeName extends "boolean" ? boolean
: never;
type InferFrom<
EMC extends Entity.Meta.Config,
PEMC extends Entity.Meta.Config,
ValidField,
F extends ValidField,
> = F extends keyof EMC ? InferMetaType<EMC[F]>
: F extends keyof PEMC ? InferMetaType<PEMC[F]>
: never;
namespace Type {
type Names = "text" | "int" | "real" | "boolean";
}
}
}