[picomatch] Improve types to accept more accurate options. (#44276)

* [picomatch] Add basic types.

* [picomatch] Fix some lint issues.

* Update github link for definition author.

* Add more PicomatchOptions.
This commit is contained in:
Patrick 2020-04-27 23:46:28 +02:00 committed by GitHub
parent c3c1d0f27d
commit d562e5ee9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,10 @@ interface PicomatchOptions {
onResult?: (result: Result) => void;
onIgnore?: (result: Result) => void;
onMatch?: (result: Result) => void;
dot?: boolean;
windows?: boolean;
contains?: boolean;
format?: (input: string) => string;
}
type Matcher = (test: string) => boolean;
@ -52,7 +56,7 @@ interface Picomatch {
test(
input: string,
regex: RegExp,
options: { format: any },
options?: PicomatchOptions,
test?: {},
): { isMatch: boolean; match: boolean; output: any };
@ -66,12 +70,17 @@ interface Picomatch {
compileRe(
state: ReturnType<typeof parse>,
options?: { contains?: boolean },
options?: PicomatchOptions,
returnOutput?: boolean,
returnState?: boolean,
): RegExp;
makeRe(input: string, options?: {}, returnOutput?: boolean, returnState?: boolean): Picomatch['compileRe'];
makeRe(
input: string,
options?: PicomatchOptions,
returnOutput?: boolean,
returnState?: boolean,
): Picomatch['compileRe'];
toRegex(source: string | RegExp, options?: { flags?: string; nocase?: boolean; debug?: boolean }): RegExp;