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' )
4
4
5
5
export type MagicRegExp <
6
6
Value extends string ,
7
7
NamedGroups extends string | never = never ,
8
8
Flags extends string | never = never
9
9
> = RegExp & {
10
- [ NamedGroups ] : NamedGroups
11
- [ Value ] : Value
12
- [ Flags ] : Flags
10
+ [ NamedGroupsS ] : NamedGroups
11
+ [ ValueS ] : Value
12
+ [ FlagsS ] : Flags
13
13
}
14
14
15
15
type 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', () => {
20
20
expect ( 'thing' . match ( regExp ) ?. [ 0 ] ) . toMatchInlineSnapshot ( '"in"' )
21
21
expect ( regExp . test ( 'thing' ) ) . toBeTruthy ( )
22
22
expect ( regExp . lastIndex ) . toMatchInlineSnapshot ( '4' )
23
+ expectTypeOf ( regExp ) . not . toEqualTypeOf ( RegExp )
23
24
} )
24
25
it ( 'collects flag type' , ( ) => {
25
26
const re = createRegExp ( '.' , [ global , multiline ] )
You can’t perform that action at this time.
0 commit comments