From d562e5ee9fb6da1146dcb19fad3aaceec3843b32 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 27 Apr 2020 23:46:28 +0200 Subject: [PATCH] [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. --- types/picomatch/index.d.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/types/picomatch/index.d.ts b/types/picomatch/index.d.ts index 67a0fc2061..96e0ba2d81 100644 --- a/types/picomatch/index.d.ts +++ b/types/picomatch/index.d.ts @@ -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, - 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;