mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
'Cannot invoke an expression whose type lacks a call signature. Type 'typeof 'js-schema'' has no compatible call signatures.'
while importing with 'import * as schema from 'js-schema''
The previous import strategie ('import {default as schema} from 'js-schema') where raising an error after compilation.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
// Type definitions for js-schema
|
|
// Project: https://github.com/molnarg/js-schema
|
|
// Definitions by: Marcin Porebski <https://github.com/marcinporebski>, Robin Labat <https://github.com/roblabat>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
|
|
declare module 'js-schema'
|
|
{
|
|
function schema(definition: any): schema.Schema;
|
|
|
|
namespace schema {
|
|
interface Schema {
|
|
(obj: any): boolean; // test obj against the schema
|
|
}
|
|
}
|
|
|
|
export = schema;
|
|
}
|
|
|
|
interface NumberConstructor {
|
|
min(n: number): NumberConstructor;
|
|
max(n: number): NumberConstructor;
|
|
below(n: number): NumberConstructor;
|
|
above(n: number): NumberConstructor;
|
|
step(n: number): NumberConstructor;
|
|
}
|
|
|
|
interface StringConstructor {
|
|
of(charset: string): StringConstructor;
|
|
of(length: number, charset: string): StringConstructor;
|
|
of(minLength: number, maxLength: number, charset: string): StringConstructor;
|
|
}
|
|
|
|
interface ArrayConstructor {
|
|
like(arr: Array<any>): ArrayConstructor;
|
|
of(pattern: any): ArrayConstructor;
|
|
of(length: number, pattern: any): ArrayConstructor;
|
|
of(minLength: number, maxLength: number, pattern: any): ArrayConstructor;
|
|
}
|
|
|
|
interface ObjectConstructor {
|
|
like(obj: any): ObjectConstructor;
|
|
reference(obj: any): ObjectConstructor;
|
|
}
|
|
|
|
interface FunctionConstructor {
|
|
reference(func: Function): FunctionConstructor;
|
|
} |