Comparing version 3.2.21 to 3.2.22
@@ -15,2 +15,7 @@ # Changelog | ||
# v3.2.22 | ||
- **Polish** | ||
- Update TypeScript definitions to allow module augmentation (@RedRoserade) | ||
# v3.2.21 | ||
@@ -17,0 +22,0 @@ |
447
index.d.ts
@@ -1,273 +0,268 @@ | ||
declare module Tcomb { | ||
type Predicate<T> = (x: T) => boolean; | ||
type TypeGuardPredicate<T> = (x: any) => x is T; | ||
type Predicate<T> = (x: T) => boolean; | ||
type TypeGuardPredicate<T> = (x: any) => x is T; | ||
interface Type<T> extends Function { | ||
(value: T): T; | ||
is: TypeGuardPredicate<T>; | ||
displayName: string; | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
}; | ||
t: T; | ||
} | ||
interface Type<T> extends Function { | ||
(value: T): T; | ||
is: TypeGuardPredicate<T>; | ||
displayName: string; | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
}; | ||
t: T; | ||
} | ||
// | ||
// irreducible | ||
// | ||
// | ||
// irreducible | ||
// | ||
interface Irreducible<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
predicate: TypeGuardPredicate<T>; | ||
}; | ||
} | ||
interface Irreducible<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
predicate: TypeGuardPredicate<T>; | ||
}; | ||
} | ||
export function irreducible<T>(name: string, predicate: Predicate<any>): Irreducible<T>; | ||
export function irreducible<T>(name: string, predicate: Predicate<any>): Irreducible<T>; | ||
// | ||
// basic types | ||
// | ||
// | ||
// basic types | ||
// | ||
export var Any: Irreducible<any>; | ||
export var Nil: Irreducible<void | null>; | ||
export var String: Irreducible<string>; | ||
export var Number: Irreducible<number>; | ||
export var Integer: Irreducible<number>; | ||
export var Boolean: Irreducible<boolean>; | ||
export var Array: Irreducible<Array<any>>; | ||
export var Object: Irreducible<Object>; // FIXME restrict to POJOs | ||
export var Function: Irreducible<Function>; | ||
export var Error: Irreducible<Error>; | ||
export var RegExp: Irreducible<RegExp>; | ||
export var Date: Irreducible<Date>; | ||
export var Any: Irreducible<any>; | ||
export var Nil: Irreducible<void | null>; | ||
export var String: Irreducible<string>; | ||
export var Number: Irreducible<number>; | ||
export var Integer: Irreducible<number>; | ||
export var Boolean: Irreducible<boolean>; | ||
export var Array: Irreducible<Array<any>>; | ||
export var Object: Irreducible<Object>; // FIXME restrict to POJOs | ||
export var Function: Irreducible<Function>; | ||
export var Error: Irreducible<Error>; | ||
export var RegExp: Irreducible<RegExp>; | ||
export var Date: Irreducible<Date>; | ||
interface ApplyCommand { $apply: Function; } | ||
interface PushCommand { $push: Array<any>; } | ||
interface RemoveCommand { $remove: Array<string>; } | ||
interface SetCommand { $set: any; } | ||
interface SpliceCommand { $splice: Array<Array<any>>; } | ||
interface SwapCommand { $swap: { from: number; to: number; }; } | ||
interface UnshiftCommand { $unshift: Array<any>; } | ||
interface MergeCommand { $merge: Object; } | ||
type Command = ApplyCommand | PushCommand | RemoveCommand | SetCommand | SpliceCommand | SwapCommand | UnshiftCommand | MergeCommand; | ||
type UpdatePatch = Command | { [key: string]: UpdatePatch }; | ||
type Update<T> = (instance: T, spec: UpdatePatch) => T; | ||
interface ApplyCommand { $apply: Function; } | ||
interface PushCommand { $push: Array<any>; } | ||
interface RemoveCommand { $remove: Array<string>; } | ||
interface SetCommand { $set: any; } | ||
interface SpliceCommand { $splice: Array<Array<any>>; } | ||
interface SwapCommand { $swap: { from: number; to: number; }; } | ||
interface UnshiftCommand { $unshift: Array<any>; } | ||
interface MergeCommand { $merge: Object; } | ||
type Command = ApplyCommand | PushCommand | RemoveCommand | SetCommand | SpliceCommand | SwapCommand | UnshiftCommand | MergeCommand; | ||
type UpdatePatch = Command | {[key: string]: UpdatePatch}; | ||
type Update<T> = (instance: T, spec: UpdatePatch) => T; | ||
type Constructor<T> = Type<T> | Function; | ||
type Constructor<T> = Type<T> | Function; | ||
// | ||
// refinement | ||
// | ||
// | ||
// refinement | ||
// | ||
interface Refinement<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
predicate: TypeGuardPredicate<T>; | ||
}; | ||
update: Update<T>; | ||
} | ||
interface Refinement<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
predicate: TypeGuardPredicate<T>; | ||
}; | ||
update: Update<T>; | ||
} | ||
export function refinement<T>(type: Constructor<T>, predicate: Predicate<T>, name?: string): Refinement<T>; | ||
export function refinement<T>(type: Constructor<T>, predicate: Predicate<T>, name?: string): Refinement<T>; | ||
// | ||
// struct | ||
// | ||
// | ||
// struct | ||
// | ||
type StructProps = { [key: string]: Constructor<any> }; | ||
type StructMixin = StructProps | Struct<any> | Interface<any>; | ||
type StructProps = {[key: string]: Constructor<any>}; | ||
type StructMixin = StructProps | Struct<any> | Interface<any>; | ||
interface Struct<T> extends Type<T> { | ||
new (value: T): T; | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
props: StructProps; | ||
strict: boolean; | ||
}; | ||
update: Update<T>; | ||
extend<E extends T>(mixins: StructMixin | Array<StructMixin>, name?: string): Struct<E>; | ||
} | ||
type StructOptions = { | ||
name?: string, | ||
strict?: boolean | ||
interface Struct<T> extends Type<T> { | ||
new(value: T): T; | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
props: StructProps; | ||
strict: boolean; | ||
}; | ||
update: Update<T>; | ||
extend<E extends T>(mixins: StructMixin | Array<StructMixin>, name?: string): Struct<E>; | ||
} | ||
export function struct<T>(props: StructProps, name?: string | StructOptions): Struct<T>; | ||
type StructOptions = { | ||
name?: string, | ||
strict?: boolean | ||
}; | ||
// | ||
// interface | ||
// | ||
export function struct<T>(props: StructProps, name?: string | StructOptions): Struct<T>; | ||
interface Interface<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
props: StructProps; | ||
strict: boolean; | ||
}; | ||
update: Update<T>; | ||
extend<E extends T>(mixins: StructMixin | Array<StructMixin>, name?: string): Struct<E>; | ||
} | ||
// | ||
// interface | ||
// | ||
export function interface<T>(props: StructProps, name?: string | StructOptions): Interface<T>; | ||
interface Interface<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
props: StructProps; | ||
strict: boolean; | ||
}; | ||
update: Update<T>; | ||
extend<E extends T>(mixins: StructMixin | Array<StructMixin>, name?: string): Struct<E>; | ||
} | ||
// | ||
// list | ||
// | ||
export function interface<T>(props: StructProps, name?: string | StructOptions): Interface<T>; | ||
interface List<T> extends Type<Array<T>> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
}; | ||
update: Update<Array<T>>; | ||
} | ||
// | ||
// list | ||
// | ||
export function list<T>(type: Constructor<T>, name?: string): List<T>; | ||
interface List<T> extends Type<Array<T>> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
}; | ||
update: Update<Array<T>>; | ||
} | ||
// | ||
// dict combinator | ||
// | ||
export function list<T>(type: Constructor<T>, name?: string): List<T>; | ||
interface Dict<T> extends Type<{[key: string]: T;}> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
domain: Constructor<string>; | ||
codomain: T; | ||
}; | ||
update: Update<{[key: string]: T;}>; | ||
} | ||
// | ||
// dict combinator | ||
// | ||
export function dict<T>(domain: Constructor<string>, codomain: Constructor<T>, name?: string): Dict<T>; | ||
interface Dict<T> extends Type<{ [key: string]: T; }> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
domain: Constructor<string>; | ||
codomain: T; | ||
}; | ||
update: Update<{ [key: string]: T; }>; | ||
} | ||
// | ||
// enums combinator | ||
// | ||
export function dict<T>(domain: Constructor<string>, codomain: Constructor<T>, name?: string): Dict<T>; | ||
interface Enums extends Type<string> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
map: Object; | ||
}; | ||
} | ||
// | ||
// enums combinator | ||
// | ||
interface EnumsFunction extends Function { | ||
(map: Object, name?: string): Enums; | ||
of(enums: string, name?: string): Enums; | ||
of(enums: Array<string>, name?: string): Enums; | ||
} | ||
interface Enums extends Type<string> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
map: Object; | ||
}; | ||
} | ||
export var enums: EnumsFunction; | ||
interface EnumsFunction extends Function { | ||
(map: Object, name?: string): Enums; | ||
of(enums: string, name?: string): Enums; | ||
of(enums: Array<string>, name?: string): Enums; | ||
} | ||
// | ||
// maybe combinator | ||
// | ||
export var enums: EnumsFunction; | ||
interface Maybe<T> extends Type<void | T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
}; | ||
update: Update<void | T>; | ||
} | ||
// | ||
// maybe combinator | ||
// | ||
export function maybe<T>(type: Constructor<T>, name?: string): Maybe<T>; | ||
interface Maybe<T> extends Type<void | T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
type: Constructor<T>; | ||
}; | ||
update: Update<void | T>; | ||
} | ||
// | ||
// tuple combinator | ||
// | ||
export function maybe<T>(type: Constructor<T>, name?: string): Maybe<T>; | ||
interface Tuple<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<any>>; | ||
}; | ||
update: Update<T>; | ||
} | ||
// | ||
// tuple combinator | ||
// | ||
export function tuple<T>(types: Array<Constructor<any>>, name?: string): Tuple<T>; | ||
interface Tuple<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<any>>; | ||
}; | ||
update: Update<T>; | ||
} | ||
// | ||
// union combinator | ||
// | ||
export function tuple<T>(types: Array<Constructor<any>>, name?: string): Tuple<T>; | ||
interface Union<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<T>>; | ||
}; | ||
update: Update<T>; | ||
dispatch(x: any): Constructor<T>; | ||
} | ||
// | ||
// union combinator | ||
// | ||
export function union<T>(types: Array<Constructor<T>>, name?: string): Union<T>; | ||
interface Union<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<T>>; | ||
}; | ||
update: Update<T>; | ||
dispatch(x: any): Constructor<T>; | ||
} | ||
// | ||
// intersection combinator | ||
// | ||
export function union<T>(types: Array<Constructor<T>>, name?: string): Union<T>; | ||
interface Intersection<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<any>>; | ||
}; | ||
update: Update<T>; | ||
} | ||
// | ||
// intersection combinator | ||
// | ||
export function intersection<T>(types: Array<Constructor<any>>, name?: string): Intersection<T>; | ||
interface Intersection<T> extends Type<T> { | ||
meta: { | ||
kind: string; | ||
name: string; | ||
identity: boolean; | ||
types: Array<Constructor<any>>; | ||
}; | ||
update: Update<T>; | ||
} | ||
// | ||
// declare combinator | ||
// | ||
export function intersection<T>(types: Array<Constructor<any>>, name?: string): Intersection<T>; | ||
interface Declare<T> extends Type<T> { | ||
update: Update<T>; | ||
define(type: Type<any>): void; | ||
} | ||
// | ||
// declare combinator | ||
// | ||
export function declare<T>(name?: string): Declare<T>; | ||
interface Declare<T> extends Type<T> { | ||
update: Update<T>; | ||
define(type: Type<any>): void; | ||
} | ||
// | ||
// other exports | ||
// | ||
export function declare<T>(name?: string): Declare<T>; | ||
export function is<T>(x: any, type: Constructor<T>): boolean; | ||
type LazyMessage = () => string; | ||
export function assert(guard: boolean, message?: string | LazyMessage): void; | ||
export function fail(message: string): void; | ||
export function isType<T>(x: Constructor<T>): boolean; | ||
export function getTypeName<T>(x: Constructor<T>): string; | ||
export function mixin<T, S>(target: T, source: S, overwrite?: boolean): T & S; | ||
type Function1 = (x: any) => any; | ||
type Clause = Constructor<any> | Function1; | ||
export function match(x: any, ...clauses: Array<Clause>): any; // FIXME | ||
export var update: Update<Object>; | ||
} | ||
// | ||
// other exports | ||
// | ||
export = Tcomb | ||
export function is<T>(x: any, type: Constructor<T>): boolean; | ||
type LazyMessage = () => string; | ||
export function assert(guard: boolean, message?: string | LazyMessage): void; | ||
export function fail(message: string): void; | ||
export function isType<T>(x: Constructor<T>): boolean; | ||
export function getTypeName<T>(x: Constructor<T>): string; | ||
export function mixin<T, S>(target: T, source: S, overwrite?: boolean): T & S; | ||
type Function1 = (x: any) => any; | ||
type Clause = Constructor<any> | Function1; | ||
export function match(x: any, ...clauses: Array<Clause>): any; // FIXME | ||
export var update: Update<Object>; |
{ | ||
"name": "tcomb", | ||
"version": "3.2.21", | ||
"version": "3.2.22", | ||
"description": "Type checking and DDD for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91122
1962