declare namespace schema { export type StrategyFunction = (value: any, parent: any, key: string) => T; export type SchemaFunction = (value: any, parent: any, key: string) => string; export type MergeFunction = (entityA: any, entityB: any) => any; export type FallbackFunction = (key: string, schema: schema.Entity) => T; export class Array { constructor(definition: Schema, schemaAttribute?: string | SchemaFunction) define(definition: Schema): void } export interface EntityOptions { idAttribute?: string | SchemaFunction mergeStrategy?: MergeFunction processStrategy?: StrategyFunction fallbackStrategy?: FallbackFunction } export class Entity { constructor(key: string | symbol, definition?: Schema, options?: EntityOptions) define(definition: Schema): void key: string getId: SchemaFunction _processStrategy: StrategyFunction } export class Object { constructor(definition: SchemaObject) define(definition: Schema): void } export class Union { constructor(definition: Schema, schemaAttribute?: string | SchemaFunction) define(definition: Schema): void } export class Values { constructor(definition: Schema, schemaAttribute?: string | SchemaFunction) define(definition: Schema): void } } export type Schema = | schema.Entity | schema.Object | schema.Union | schema.Values | SchemaObject | SchemaArray; export type SchemaValueFunction = (t: T) => Schema; export type SchemaValue = Schema | SchemaValueFunction; export interface SchemaObject { [key: string]: SchemaValue } export interface SchemaArray extends Array> {} export type NormalizedSchema = { entities: E, result: R }; export function normalize( data: any, schema: Schema ): NormalizedSchema; export function denormalize( input: any, schema: Schema, entities: any ): any;