|
1 | | -declare namespace TypeCheck { |
2 | | - export interface CustomType { |
3 | | - [typeName: string]: { |
4 | | - typeOf: string; |
5 | | - validate: (x: any) => any; |
6 | | - }; |
7 | | - } |
8 | | - |
9 | | - export interface Options { |
10 | | - customTypes: CustomType; |
11 | | - } |
12 | | - |
13 | | - export interface TC { |
14 | | - VERSION: string; |
15 | | - typeCheck: (typeDescription: string, inst: any, options?: Options) => boolean; |
16 | | - parseType: (typeDescription: string) => Object; |
17 | | - parsedTypeCheck: (parsedType: any, obj: any) => boolean; |
18 | | - } |
| 1 | +export const VERSION: string; |
| 2 | + |
| 3 | +export interface CustomType { |
| 4 | + typeOf: string; |
| 5 | + validate: (input: unknown) => boolean; |
| 6 | +} |
| 7 | + |
| 8 | +export interface CustomTypes { |
| 9 | + [typeName: string]: CustomType; |
| 10 | +} |
| 11 | + |
| 12 | +export interface Options { |
| 13 | + customTypes?: CustomTypes; |
19 | 14 | } |
20 | 15 |
|
21 | | -declare var typecheck: TypeCheck.TC; |
| 16 | +export function typeCheck(type: string, input: unknown, options?: Options): boolean; |
| 17 | + |
| 18 | +// This is, in fact, a single element tuple. |
| 19 | +// eslint-disable-next-line @definitelytyped/no-single-element-tuple-type |
| 20 | +export type ParsedType = [ParsedTypeData]; |
22 | 21 |
|
23 | | -declare module "type-check" { |
24 | | - export = typecheck; |
| 22 | +export interface ParsedTypeData { |
| 23 | + type: string; |
25 | 24 | } |
| 25 | + |
| 26 | +export function parseType(type: string): ParsedType; |
| 27 | + |
| 28 | +export function parsedTypeCheck(parsedType: ParsedType, input: string, options?: Options): boolean; |
0 commit comments