UNPKG

1.14 kBTypeScriptView Raw
1export default class ParameterType<T> {
2 readonly name: string;
3 private readonly type;
4 readonly useForSnippets: boolean;
5 readonly preferForRegexpMatch: boolean;
6 private transformFn;
7 static compare(pt1: ParameterType<any>, pt2: ParameterType<any>): number;
8 static checkParameterTypeName(typeName: string): void;
9 regexpStrings: string[];
10 /**
11 * @param name {String} the name of the type
12 * @param regexps {Array.<RegExp>,RegExp,Array.<String>,String} that matches the type
13 * @param type {Function} the prototype (constructor) of the type. May be null.
14 * @param transform {Function} function transforming string to another type. May be null.
15 * @param useForSnippets {boolean} true if this should be used for snippets. Defaults to true.
16 * @param preferForRegexpMatch {boolean} true if this is a preferential type. Defaults to false.
17 */
18 constructor(name: string, regexps: RegExp[] | string[] | RegExp | string, type: any, transform: (...match: string[]) => T, useForSnippets: boolean, preferForRegexpMatch: boolean);
19 transform(thisObj: any, groupValues: string[]): any;
20}