File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 3
3
export type Flag = 'd' | 'g' | 'i' | 'm' | 's' | 'u' | 'y'
4
4
5
5
/** Generate indices for substring matches */
6
- export const withIndices : Flag = 'd'
6
+ export const withIndices = 'd'
7
7
8
8
/** Case-insensitive search */
9
- export const caseInsensitive : Flag = 'i'
9
+ export const caseInsensitive = 'i'
10
10
11
11
/** Global search */
12
- export const global : Flag = 'g'
12
+ export const global = 'g'
13
13
14
14
/** Multi-line search */
15
- export const multiline : Flag = 'm'
15
+ export const multiline = 'm'
16
16
17
17
/** Allows `.` to match newline characters */
18
- export const dotAll : Flag = 's'
18
+ export const dotAll = 's'
19
19
20
20
/** Treat a pattern as a sequence of unicode code points */
21
- export const unicode : Flag = 'u'
21
+ export const unicode = 'u'
22
22
23
23
/** Perform a "sticky" search that matches starting at the current position in the target string */
24
- export const sticky : Flag = 'y'
24
+ export const sticky = 'y'
Original file line number Diff line number Diff line change
1
+ import { it , describe } from 'vitest'
2
+ import { expectTypeOf } from 'expect-type'
3
+ import * as flags from '../src/core/flags'
4
+ import type { Flag } from '../src/core/flags'
5
+
6
+ type ValueOf < T > = T [ keyof T ]
7
+
8
+ describe ( 'flags' , ( ) => {
9
+ it ( 'are all present' , ( ) => {
10
+ expectTypeOf < Flag > ( ) . toMatchTypeOf < ValueOf < typeof flags > > ( )
11
+ } )
12
+ } )
You can’t perform that action at this time.
0 commit comments