File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 1- const NamedGroups = Symbol ( 'NamedGroups' )
2- const Value = Symbol ( 'Value' )
3- const Flags = Symbol ( 'Flags' )
1+ const NamedGroupsS = Symbol ( 'NamedGroups' )
2+ const ValueS = Symbol ( 'Value' )
3+ const FlagsS = Symbol ( 'Flags' )
44
55export type MagicRegExp <
66 Value extends string ,
77 NamedGroups extends string | never = never ,
88 Flags extends string | never = never
99> = RegExp & {
10- [ NamedGroups ] : NamedGroups
11- [ Value ] : Value
12- [ Flags ] : Flags
10+ [ NamedGroupsS ] : NamedGroups
11+ [ ValueS ] : Value
12+ [ FlagsS ] : Flags
1313}
1414
1515type ExtractGroups < T extends MagicRegExp < string , string , string > > = T extends MagicRegExp <
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ describe('magic-regexp', () => {
2020 expect ( 'thing' . match ( regExp ) ?. [ 0 ] ) . toMatchInlineSnapshot ( '"in"' )
2121 expect ( regExp . test ( 'thing' ) ) . toBeTruthy ( )
2222 expect ( regExp . lastIndex ) . toMatchInlineSnapshot ( '4' )
23+ expectTypeOf ( regExp ) . not . toEqualTypeOf ( RegExp )
2324 } )
2425 it ( 'collects flag type' , ( ) => {
2526 const re = createRegExp ( '.' , [ global , multiline ] )
You can’t perform that action at this time.
0 commit comments