@@ -73,7 +73,7 @@ export type UnicodeSetsCharacterClassElement =
73
73
/**
74
74
* The type which defines common properties for all node types.
75
75
*/
76
- export interface NodeBase {
76
+ export type NodeBase = {
77
77
/** The node type. */
78
78
type : Node [ "type" ]
79
79
/** The parent node. */
@@ -89,7 +89,7 @@ export interface NodeBase {
89
89
/**
90
90
* The root node.
91
91
*/
92
- export interface RegExpLiteral extends NodeBase {
92
+ export type RegExpLiteral = NodeBase & {
93
93
type : "RegExpLiteral"
94
94
parent : null
95
95
pattern : Pattern
@@ -99,7 +99,7 @@ export interface RegExpLiteral extends NodeBase {
99
99
/**
100
100
* The pattern.
101
101
*/
102
- export interface Pattern extends NodeBase {
102
+ export type Pattern = NodeBase & {
103
103
type : "Pattern"
104
104
parent : RegExpLiteral | null
105
105
alternatives : Alternative [ ]
@@ -109,7 +109,7 @@ export interface Pattern extends NodeBase {
109
109
* The alternative.
110
110
* E.g. `a|b`
111
111
*/
112
- export interface Alternative extends NodeBase {
112
+ export type Alternative = NodeBase & {
113
113
type : "Alternative"
114
114
parent : CapturingGroup | Group | LookaroundAssertion | Pattern
115
115
elements : Element [ ]
@@ -119,7 +119,7 @@ export interface Alternative extends NodeBase {
119
119
* The uncapturing group.
120
120
* E.g. `(?:ab)`
121
121
*/
122
- export interface Group extends NodeBase {
122
+ export type Group = NodeBase & {
123
123
type : "Group"
124
124
parent : Alternative | Quantifier
125
125
alternatives : Alternative [ ]
@@ -129,7 +129,7 @@ export interface Group extends NodeBase {
129
129
* The capturing group.
130
130
* E.g. `(ab)`, `(?<name>ab)`
131
131
*/
132
- export interface CapturingGroup extends NodeBase {
132
+ export type CapturingGroup = NodeBase & {
133
133
type : "CapturingGroup"
134
134
parent : Alternative | Quantifier
135
135
name : string | null
@@ -146,7 +146,7 @@ export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion
146
146
* The lookahead assertion.
147
147
* E.g. `(?=ab)`, `(?!ab)`
148
148
*/
149
- export interface LookaheadAssertion extends NodeBase {
149
+ export type LookaheadAssertion = NodeBase & {
150
150
type : "Assertion"
151
151
parent : Alternative | Quantifier
152
152
kind : "lookahead"
@@ -158,7 +158,7 @@ export interface LookaheadAssertion extends NodeBase {
158
158
* The lookbehind assertion.
159
159
* E.g. `(?<=ab)`, `(?<!ab)`
160
160
*/
161
- export interface LookbehindAssertion extends NodeBase {
161
+ export type LookbehindAssertion = NodeBase & {
162
162
type : "Assertion"
163
163
parent : Alternative
164
164
kind : "lookbehind"
@@ -170,7 +170,7 @@ export interface LookbehindAssertion extends NodeBase {
170
170
* The quantifier.
171
171
* E.g. `a?`, `a*`, `a+`, `a{1,2}`, `a??`, `a*?`, `a+?`, `a{1,2}?`
172
172
*/
173
- export interface Quantifier extends NodeBase {
173
+ export type Quantifier = NodeBase & {
174
174
type : "Quantifier"
175
175
parent : Alternative
176
176
min : number
@@ -186,7 +186,7 @@ export interface Quantifier extends NodeBase {
186
186
export type CharacterClass =
187
187
| ClassRangesCharacterClass
188
188
| UnicodeSetsCharacterClass
189
- interface BaseCharacterClass extends NodeBase {
189
+ type BaseCharacterClass = NodeBase & {
190
190
type : "CharacterClass"
191
191
parent :
192
192
| Alternative
@@ -204,7 +204,7 @@ interface BaseCharacterClass extends NodeBase {
204
204
*
205
205
* In Unicode sets mode (`v` flag), {@link UnicodeSetsCharacterClass} is used.
206
206
*/
207
- export interface ClassRangesCharacterClass extends BaseCharacterClass {
207
+ export type ClassRangesCharacterClass = BaseCharacterClass & {
208
208
parent : Alternative | Quantifier
209
209
unicodeSets : false
210
210
elements : ClassRangesCharacterClassElement [ ]
@@ -214,7 +214,7 @@ export interface ClassRangesCharacterClass extends BaseCharacterClass {
214
214
*
215
215
* This character class may contain strings.
216
216
*/
217
- export interface UnicodeSetsCharacterClass extends BaseCharacterClass {
217
+ export type UnicodeSetsCharacterClass = BaseCharacterClass & {
218
218
parent :
219
219
| Alternative
220
220
| ExpressionCharacterClass
@@ -228,7 +228,7 @@ export interface UnicodeSetsCharacterClass extends BaseCharacterClass {
228
228
* The character class.
229
229
* E.g. `[a-b]`
230
230
*/
231
- export interface CharacterClassRange extends NodeBase {
231
+ export type CharacterClassRange = NodeBase & {
232
232
type : "CharacterClassRange"
233
233
parent : CharacterClass
234
234
min : Character
@@ -249,7 +249,7 @@ export type BoundaryAssertion = EdgeAssertion | WordBoundaryAssertion
249
249
* The edge boundary assertion.
250
250
* E.g. `^`, `$`
251
251
*/
252
- export interface EdgeAssertion extends NodeBase {
252
+ export type EdgeAssertion = NodeBase & {
253
253
type : "Assertion"
254
254
parent : Alternative | Quantifier
255
255
kind : "end" | "start"
@@ -259,7 +259,7 @@ export interface EdgeAssertion extends NodeBase {
259
259
* The word bondary assertion.
260
260
* E.g. `\b`, `\B`
261
261
*/
262
- export interface WordBoundaryAssertion extends NodeBase {
262
+ export type WordBoundaryAssertion = NodeBase & {
263
263
type : "Assertion"
264
264
parent : Alternative | Quantifier
265
265
kind : "word"
@@ -278,7 +278,7 @@ export type CharacterSet =
278
278
* The dot.
279
279
* E.g. `.`
280
280
*/
281
- export interface AnyCharacterSet extends NodeBase {
281
+ export type AnyCharacterSet = NodeBase & {
282
282
type : "CharacterSet"
283
283
parent : Alternative | Quantifier
284
284
kind : "any"
@@ -288,7 +288,7 @@ export interface AnyCharacterSet extends NodeBase {
288
288
* The character class escape.
289
289
* E.g. `\d`, `\s`, `\w`, `\D`, `\S`, `\W`
290
290
*/
291
- export interface EscapeCharacterSet extends NodeBase {
291
+ export type EscapeCharacterSet = NodeBase & {
292
292
type : "CharacterSet"
293
293
parent :
294
294
| Alternative
@@ -307,7 +307,7 @@ export interface EscapeCharacterSet extends NodeBase {
307
307
export type UnicodePropertyCharacterSet =
308
308
| CharacterUnicodePropertyCharacterSet
309
309
| StringsUnicodePropertyCharacterSet
310
- interface BaseUnicodePropertyCharacterSet extends NodeBase {
310
+ type BaseUnicodePropertyCharacterSet = NodeBase & {
311
311
type : "CharacterSet"
312
312
parent :
313
313
| Alternative
@@ -321,31 +321,31 @@ interface BaseUnicodePropertyCharacterSet extends NodeBase {
321
321
value : string | null
322
322
negate : boolean
323
323
}
324
- export interface CharacterUnicodePropertyCharacterSet
325
- extends BaseUnicodePropertyCharacterSet {
326
- strings : false
327
- value : string | null
328
- negate : boolean
329
- }
324
+ export type CharacterUnicodePropertyCharacterSet =
325
+ BaseUnicodePropertyCharacterSet & {
326
+ strings : false
327
+ value : string | null
328
+ negate : boolean
329
+ }
330
330
/** StringsUnicodePropertyCharacterSet is Unicode property escape with property of strings. */
331
- export interface StringsUnicodePropertyCharacterSet
332
- extends BaseUnicodePropertyCharacterSet {
333
- parent :
334
- | Alternative
335
- | ClassIntersection
336
- | ClassSubtraction
337
- | Quantifier
338
- | UnicodeSetsCharacterClass
339
- strings : true
340
- value : null
341
- negate : false
342
- }
331
+ export type StringsUnicodePropertyCharacterSet =
332
+ BaseUnicodePropertyCharacterSet & {
333
+ parent :
334
+ | Alternative
335
+ | ClassIntersection
336
+ | ClassSubtraction
337
+ | Quantifier
338
+ | UnicodeSetsCharacterClass
339
+ strings : true
340
+ value : null
341
+ negate : false
342
+ }
343
343
344
344
/**
345
345
* The expression character class.
346
346
* E.g. `[a--b]`, `[a&&b]`,`[^a--b]`, `[^a&&b]`
347
347
*/
348
- export interface ExpressionCharacterClass extends NodeBase {
348
+ export type ExpressionCharacterClass = NodeBase & {
349
349
type : "ExpressionCharacterClass"
350
350
parent :
351
351
| Alternative
@@ -368,7 +368,7 @@ export type ClassSetOperand =
368
368
* The character class intersection.
369
369
* E.g. `a&&b`
370
370
*/
371
- export interface ClassIntersection extends NodeBase {
371
+ export type ClassIntersection = NodeBase & {
372
372
type : "ClassIntersection"
373
373
parent : ClassIntersection | ExpressionCharacterClass
374
374
left : ClassIntersection | ClassSetOperand
@@ -379,7 +379,7 @@ export interface ClassIntersection extends NodeBase {
379
379
* The character class subtraction.
380
380
* E.g. `a--b`
381
381
*/
382
- export interface ClassSubtraction extends NodeBase {
382
+ export type ClassSubtraction = NodeBase & {
383
383
type : "ClassSubtraction"
384
384
parent : ClassSubtraction | ExpressionCharacterClass
385
385
left : ClassSetOperand | ClassSubtraction
@@ -390,14 +390,14 @@ export interface ClassSubtraction extends NodeBase {
390
390
* The character class string disjunction.
391
391
* E.g. `\q{a|b}`
392
392
*/
393
- export interface ClassStringDisjunction extends NodeBase {
393
+ export type ClassStringDisjunction = NodeBase & {
394
394
type : "ClassStringDisjunction"
395
395
parent : ClassIntersection | ClassSubtraction | UnicodeSetsCharacterClass
396
396
alternatives : StringAlternative [ ]
397
397
}
398
398
399
399
/** StringAlternative is only used for `\q{alt}`({@link ClassStringDisjunction}). */
400
- export interface StringAlternative extends NodeBase {
400
+ export type StringAlternative = NodeBase & {
401
401
type : "StringAlternative"
402
402
parent : ClassStringDisjunction
403
403
elements : Character [ ]
@@ -408,7 +408,7 @@ export interface StringAlternative extends NodeBase {
408
408
* This includes escape sequences which mean a character.
409
409
* E.g. `a`, `あ`, `✿`, `\x65`, `\u0065`, `\u{65}`, `\/`
410
410
*/
411
- export interface Character extends NodeBase {
411
+ export type Character = NodeBase & {
412
412
type : "Character"
413
413
parent :
414
414
| Alternative
@@ -425,7 +425,7 @@ export interface Character extends NodeBase {
425
425
* The backreference.
426
426
* E.g. `\1`, `\k<name>`
427
427
*/
428
- export interface Backreference extends NodeBase {
428
+ export type Backreference = NodeBase & {
429
429
type : "Backreference"
430
430
parent : Alternative | Quantifier
431
431
ref : number | string
@@ -435,7 +435,7 @@ export interface Backreference extends NodeBase {
435
435
/**
436
436
* The flags.
437
437
*/
438
- export interface Flags extends NodeBase {
438
+ export type Flags = NodeBase & {
439
439
type : "Flags"
440
440
parent : RegExpLiteral | null
441
441
dotAll : boolean
0 commit comments