1
1
import * as eslintUtils from 'eslint-utils' ;
2
2
import { TSESTree } from '../../ts-estree' ;
3
3
4
- const isArrowToken = eslintUtils . isArrowToken as (
4
+ type IsPunctuatorTokenWithValueFunction < Value extends string > = (
5
5
token : TSESTree . Token ,
6
- ) => token is TSESTree . PunctuatorToken & { value : '=>' } ;
6
+ ) => token is TSESTree . PunctuatorToken & { value : Value } ;
7
+
8
+ const isArrowToken =
9
+ eslintUtils . isArrowToken as IsPunctuatorTokenWithValueFunction < '=>' > ;
7
10
const isNotArrowToken = eslintUtils . isNotArrowToken as (
8
11
token : TSESTree . Token ,
9
12
) => token is Exclude <
10
13
TSESTree . Token ,
11
14
TSESTree . PunctuatorToken & { value : '=>' }
12
15
> ;
13
16
14
- const isClosingBraceToken = eslintUtils . isClosingBraceToken as (
15
- token : TSESTree . Token ,
16
- ) => token is TSESTree . PunctuatorToken & { value : '}' } ;
17
+ const isClosingBraceToken =
18
+ eslintUtils . isClosingBraceToken as IsPunctuatorTokenWithValueFunction < '}' > ;
17
19
const isNotClosingBraceToken = eslintUtils . isNotClosingBraceToken as (
18
20
token : TSESTree . Token ,
19
21
) => token is Exclude <
20
22
TSESTree . Token ,
21
23
TSESTree . PunctuatorToken & { value : '}' }
22
24
> ;
23
25
24
- const isClosingBracketToken = eslintUtils . isClosingBracketToken as (
25
- token : TSESTree . Token ,
26
- ) => token is TSESTree . PunctuatorToken & { value : ']' } ;
26
+ const isClosingBracketToken =
27
+ eslintUtils . isClosingBracketToken as IsPunctuatorTokenWithValueFunction < ']' > ;
27
28
const isNotClosingBracketToken = eslintUtils . isNotClosingBracketToken as (
28
29
token : TSESTree . Token ,
29
30
) => token is Exclude <
30
31
TSESTree . Token ,
31
32
TSESTree . PunctuatorToken & { value : ']' }
32
33
> ;
33
34
34
- const isClosingParenToken = eslintUtils . isClosingParenToken as (
35
- token : TSESTree . Token ,
36
- ) => token is TSESTree . PunctuatorToken & { value : ')' } ;
35
+ const isClosingParenToken =
36
+ eslintUtils . isClosingParenToken as IsPunctuatorTokenWithValueFunction < ')' > ;
37
37
const isNotClosingParenToken = eslintUtils . isNotClosingParenToken as (
38
38
token : TSESTree . Token ,
39
39
) => token is Exclude <
40
40
TSESTree . Token ,
41
41
TSESTree . PunctuatorToken & { value : ')' }
42
42
> ;
43
43
44
- const isColonToken = eslintUtils . isColonToken as (
45
- token : TSESTree . Token ,
46
- ) => token is TSESTree . PunctuatorToken & { value : ':' } ;
44
+ const isColonToken =
45
+ eslintUtils . isColonToken as IsPunctuatorTokenWithValueFunction < ':' > ;
47
46
const isNotColonToken = eslintUtils . isNotColonToken as (
48
47
token : TSESTree . Token ,
49
48
) => token is Exclude <
50
49
TSESTree . Token ,
51
50
TSESTree . PunctuatorToken & { value : ':' }
52
51
> ;
53
52
54
- const isCommaToken = eslintUtils . isCommaToken as (
55
- token : TSESTree . Token ,
56
- ) => token is TSESTree . PunctuatorToken & { value : ',' } ;
53
+ const isCommaToken =
54
+ eslintUtils . isCommaToken as IsPunctuatorTokenWithValueFunction < ',' > ;
57
55
const isNotCommaToken = eslintUtils . isNotCommaToken as (
58
56
token : TSESTree . Token ,
59
57
) => token is Exclude <
@@ -68,39 +66,35 @@ const isNotCommentToken = eslintUtils.isNotCommentToken as (
68
66
token : TSESTree . Token ,
69
67
) => token is Exclude < TSESTree . Token , TSESTree . Comment > ;
70
68
71
- const isOpeningBraceToken = eslintUtils . isOpeningBraceToken as (
72
- token : TSESTree . Token ,
73
- ) => token is TSESTree . PunctuatorToken & { value : '{' } ;
69
+ const isOpeningBraceToken =
70
+ eslintUtils . isOpeningBraceToken as IsPunctuatorTokenWithValueFunction < '{' > ;
74
71
const isNotOpeningBraceToken = eslintUtils . isNotOpeningBraceToken as (
75
72
token : TSESTree . Token ,
76
73
) => token is Exclude <
77
74
TSESTree . Token ,
78
75
TSESTree . PunctuatorToken & { value : '{' }
79
76
> ;
80
77
81
- const isOpeningBracketToken = eslintUtils . isOpeningBracketToken as (
82
- token : TSESTree . Token ,
83
- ) => token is TSESTree . PunctuatorToken & { value : '[' } ;
78
+ const isOpeningBracketToken =
79
+ eslintUtils . isOpeningBracketToken as IsPunctuatorTokenWithValueFunction < '[' > ;
84
80
const isNotOpeningBracketToken = eslintUtils . isNotOpeningBracketToken as (
85
81
token : TSESTree . Token ,
86
82
) => token is Exclude <
87
83
TSESTree . Token ,
88
84
TSESTree . PunctuatorToken & { value : '[' }
89
85
> ;
90
86
91
- const isOpeningParenToken = eslintUtils . isOpeningParenToken as (
92
- token : TSESTree . Token ,
93
- ) => token is TSESTree . PunctuatorToken & { value : '(' } ;
87
+ const isOpeningParenToken =
88
+ eslintUtils . isOpeningParenToken as IsPunctuatorTokenWithValueFunction < '(' > ;
94
89
const isNotOpeningParenToken = eslintUtils . isNotOpeningParenToken as (
95
90
token : TSESTree . Token ,
96
91
) => token is Exclude <
97
92
TSESTree . Token ,
98
93
TSESTree . PunctuatorToken & { value : '(' }
99
94
> ;
100
95
101
- const isSemicolonToken = eslintUtils . isSemicolonToken as (
102
- token : TSESTree . Token ,
103
- ) => token is TSESTree . PunctuatorToken & { value : ';' } ;
96
+ const isSemicolonToken =
97
+ eslintUtils . isSemicolonToken as IsPunctuatorTokenWithValueFunction < ';' > ;
104
98
const isNotSemicolonToken = eslintUtils . isNotSemicolonToken as (
105
99
token : TSESTree . Token ,
106
100
) => token is Exclude <
0 commit comments