Skip to content

Commit 5847e16

Browse files
committed
feat(ast,parser): add intrinsic keyword (#3767)
closes #3759
1 parent 1190dee commit 5847e16

File tree

11 files changed

+145
-70
lines changed

11 files changed

+145
-70
lines changed

crates/oxc_ast/src/ast/macros.rs

+35-32
Original file line numberDiff line numberDiff line change
@@ -553,73 +553,75 @@ macro_rules! inherit_variants {
553553
/// Inherited from [`TSType`]
554554
TSBooleanKeyword(Box<'a, TSBooleanKeyword>) = 2,
555555
/// Inherited from [`TSType`]
556-
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 3,
556+
TSIntrinsicKeyword(Box<'a, TSIntrinsicKeyword>) = 3,
557557
/// Inherited from [`TSType`]
558-
TSNullKeyword(Box<'a, TSNullKeyword>) = 4,
558+
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 4,
559559
/// Inherited from [`TSType`]
560-
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 5,
560+
TSNullKeyword(Box<'a, TSNullKeyword>) = 5,
561561
/// Inherited from [`TSType`]
562-
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 6,
562+
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 6,
563563
/// Inherited from [`TSType`]
564-
TSStringKeyword(Box<'a, TSStringKeyword>) = 7,
564+
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 7,
565565
/// Inherited from [`TSType`]
566-
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 8,
566+
TSStringKeyword(Box<'a, TSStringKeyword>) = 8,
567567
/// Inherited from [`TSType`]
568-
TSThisType(Box<'a, TSThisType>) = 9,
568+
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 9,
569569
/// Inherited from [`TSType`]
570-
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 10,
570+
TSThisType(Box<'a, TSThisType>) = 10,
571571
/// Inherited from [`TSType`]
572-
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 11,
572+
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 11,
573573
/// Inherited from [`TSType`]
574-
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 12,
574+
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 12,
575+
/// Inherited from [`TSType`]
576+
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 13,
575577

576578
// Compound
577579
/// Inherited from [`TSType`]
578-
TSArrayType(Box<'a, TSArrayType<'a>>) = 13,
580+
TSArrayType(Box<'a, TSArrayType<'a>>) = 14,
579581
/// Inherited from [`TSType`]
580-
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 14,
582+
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 15,
581583
/// Inherited from [`TSType`]
582-
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 15,
584+
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 16,
583585
/// Inherited from [`TSType`]
584-
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 16,
586+
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 17,
585587
/// Inherited from [`TSType`]
586-
TSImportType(Box<'a, TSImportType<'a>>) = 17,
588+
TSImportType(Box<'a, TSImportType<'a>>) = 18,
587589
/// Inherited from [`TSType`]
588-
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 18,
590+
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 19,
589591
/// Inherited from [`TSType`]
590-
TSInferType(Box<'a, TSInferType<'a>>) = 19,
592+
TSInferType(Box<'a, TSInferType<'a>>) = 20,
591593
/// Inherited from [`TSType`]
592-
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 20,
594+
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 21,
593595
/// Inherited from [`TSType`]
594-
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 21,
596+
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 22,
595597
/// Inherited from [`TSType`]
596-
TSMappedType(Box<'a, TSMappedType<'a>>) = 22,
598+
TSMappedType(Box<'a, TSMappedType<'a>>) = 23,
597599
/// Inherited from [`TSType`]
598-
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 23,
600+
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 24,
599601
/// Inherited from [`TSType`]
600-
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 24,
602+
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 25,
601603
/// Inherited from [`TSType`]
602-
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 25,
604+
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 26,
603605
/// Inherited from [`TSType`]
604-
TSTupleType(Box<'a, TSTupleType<'a>>) = 26,
606+
TSTupleType(Box<'a, TSTupleType<'a>>) = 27,
605607
/// Inherited from [`TSType`]
606-
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 27,
608+
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 28,
607609
/// Inherited from [`TSType`]
608-
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 28,
610+
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 29,
609611
/// Inherited from [`TSType`]
610-
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 29,
612+
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 30,
611613
/// Inherited from [`TSType`]
612-
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 30,
614+
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 31,
613615
/// Inherited from [`TSType`]
614-
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 31,
616+
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 32,
615617
/// Inherited from [`TSType`]
616-
TSUnionType(Box<'a, TSUnionType<'a>>) = 32,
618+
TSUnionType(Box<'a, TSUnionType<'a>>) = 33,
617619

618620
// JSDoc
619621
/// Inherited from [`TSType`]
620-
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 33,
622+
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 34,
621623
/// Inherited from [`TSType`]
622-
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 34,
624+
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 35,
623625

624626
$($rest)*
625627
}
@@ -637,6 +639,7 @@ macro_rules! inherit_variants {
637639
TSAnyKeyword,
638640
TSBigIntKeyword,
639641
TSBooleanKeyword,
642+
TSIntrinsicKeyword,
640643
TSNeverKeyword,
641644
TSNullKeyword,
642645
TSNumberKeyword,

crates/oxc_ast/src/ast/ts.rs

+44-32
Original file line numberDiff line numberDiff line change
@@ -157,40 +157,41 @@ pub enum TSType<'a> {
157157
TSAnyKeyword(Box<'a, TSAnyKeyword>) = 0,
158158
TSBigIntKeyword(Box<'a, TSBigIntKeyword>) = 1,
159159
TSBooleanKeyword(Box<'a, TSBooleanKeyword>) = 2,
160-
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 3,
161-
TSNullKeyword(Box<'a, TSNullKeyword>) = 4,
162-
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 5,
163-
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 6,
164-
TSStringKeyword(Box<'a, TSStringKeyword>) = 7,
165-
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 8,
166-
TSThisType(Box<'a, TSThisType>) = 9,
167-
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 10,
168-
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 11,
169-
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 12,
160+
TSIntrinsicKeyword(Box<'a, TSIntrinsicKeyword>) = 3,
161+
TSNeverKeyword(Box<'a, TSNeverKeyword>) = 4,
162+
TSNullKeyword(Box<'a, TSNullKeyword>) = 5,
163+
TSNumberKeyword(Box<'a, TSNumberKeyword>) = 6,
164+
TSObjectKeyword(Box<'a, TSObjectKeyword>) = 7,
165+
TSStringKeyword(Box<'a, TSStringKeyword>) = 8,
166+
TSSymbolKeyword(Box<'a, TSSymbolKeyword>) = 9,
167+
TSThisType(Box<'a, TSThisType>) = 10,
168+
TSUndefinedKeyword(Box<'a, TSUndefinedKeyword>) = 11,
169+
TSUnknownKeyword(Box<'a, TSUnknownKeyword>) = 12,
170+
TSVoidKeyword(Box<'a, TSVoidKeyword>) = 13,
170171
// Compound
171-
TSArrayType(Box<'a, TSArrayType<'a>>) = 13,
172-
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 14,
173-
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 15,
174-
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 16,
175-
TSImportType(Box<'a, TSImportType<'a>>) = 17,
176-
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 18,
177-
TSInferType(Box<'a, TSInferType<'a>>) = 19,
178-
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 20,
179-
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 21,
180-
TSMappedType(Box<'a, TSMappedType<'a>>) = 22,
181-
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 23,
182-
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 24,
183-
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 25,
184-
TSTupleType(Box<'a, TSTupleType<'a>>) = 26,
185-
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 27,
186-
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 28,
187-
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 29,
188-
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 30,
189-
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 31,
190-
TSUnionType(Box<'a, TSUnionType<'a>>) = 32,
172+
TSArrayType(Box<'a, TSArrayType<'a>>) = 14,
173+
TSConditionalType(Box<'a, TSConditionalType<'a>>) = 15,
174+
TSConstructorType(Box<'a, TSConstructorType<'a>>) = 16,
175+
TSFunctionType(Box<'a, TSFunctionType<'a>>) = 17,
176+
TSImportType(Box<'a, TSImportType<'a>>) = 18,
177+
TSIndexedAccessType(Box<'a, TSIndexedAccessType<'a>>) = 19,
178+
TSInferType(Box<'a, TSInferType<'a>>) = 20,
179+
TSIntersectionType(Box<'a, TSIntersectionType<'a>>) = 21,
180+
TSLiteralType(Box<'a, TSLiteralType<'a>>) = 22,
181+
TSMappedType(Box<'a, TSMappedType<'a>>) = 23,
182+
TSNamedTupleMember(Box<'a, TSNamedTupleMember<'a>>) = 24,
183+
TSQualifiedName(Box<'a, TSQualifiedName<'a>>) = 25,
184+
TSTemplateLiteralType(Box<'a, TSTemplateLiteralType<'a>>) = 26,
185+
TSTupleType(Box<'a, TSTupleType<'a>>) = 27,
186+
TSTypeLiteral(Box<'a, TSTypeLiteral<'a>>) = 28,
187+
TSTypeOperatorType(Box<'a, TSTypeOperator<'a>>) = 29,
188+
TSTypePredicate(Box<'a, TSTypePredicate<'a>>) = 30,
189+
TSTypeQuery(Box<'a, TSTypeQuery<'a>>) = 31,
190+
TSTypeReference(Box<'a, TSTypeReference<'a>>) = 32,
191+
TSUnionType(Box<'a, TSUnionType<'a>>) = 33,
191192
// JSDoc
192-
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 33,
193-
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 34,
193+
JSDocNullableType(Box<'a, JSDocNullableType<'a>>) = 34,
194+
JSDocUnknownType(Box<'a, JSDocUnknownType>) = 35,
194195
}
195196

196197
/// Macro for matching `TSType`'s variants.
@@ -200,6 +201,7 @@ macro_rules! match_ts_type {
200201
$ty::TSAnyKeyword(_)
201202
| $ty::TSBigIntKeyword(_)
202203
| $ty::TSBooleanKeyword(_)
204+
| $ty::TSIntrinsicKeyword(_)
203205
| $ty::TSNeverKeyword(_)
204206
| $ty::TSNullKeyword(_)
205207
| $ty::TSNumberKeyword(_)
@@ -491,6 +493,16 @@ pub struct TSNeverKeyword {
491493
pub span: Span,
492494
}
493495

496+
/// `type Uppercase<T extends character> = intrinsic;`
497+
#[visited_node]
498+
#[derive(Debug, Hash)]
499+
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
500+
#[cfg_attr(feature = "serialize", serde(tag = "type"))]
501+
pub struct TSIntrinsicKeyword {
502+
#[cfg_attr(feature = "serialize", serde(flatten))]
503+
pub span: Span,
504+
}
505+
494506
#[visited_node]
495507
#[derive(Debug, Hash)]
496508
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]

crates/oxc_ast/src/ast_builder.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1979,6 +1979,11 @@ impl<'a> AstBuilder<'a> {
19791979
TSType::TSNeverKeyword(self.alloc(TSNeverKeyword { span }))
19801980
}
19811981

1982+
#[inline]
1983+
pub fn ts_intrinsic_keyword(self, span: Span) -> TSType<'a> {
1984+
TSType::TSIntrinsicKeyword(self.alloc(TSIntrinsicKeyword { span }))
1985+
}
1986+
19821987
#[inline]
19831988
pub fn ts_template_literal_type(
19841989
self,

crates/oxc_ast/src/ast_kind.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ ast_kinds! {
154154
TSAnyKeyword(&'a TSAnyKeyword),
155155
TSBigIntKeyword(&'a TSBigIntKeyword),
156156
TSBooleanKeyword(&'a TSBooleanKeyword),
157+
TSIntrinsicKeyword(&'a TSIntrinsicKeyword),
157158
TSNeverKeyword(&'a TSNeverKeyword),
158159
TSNullKeyword(&'a TSNullKeyword),
159160
TSNumberKeyword(&'a TSNumberKeyword),
@@ -251,12 +252,12 @@ impl<'a> AstKind<'a> {
251252

252253
#[rustfmt::skip]
253254
pub fn is_type(self) -> bool {
254-
matches!(self, Self::TSAnyKeyword(_) | Self::TSBigIntKeyword(_) | Self::TSBooleanKeyword(_) | Self::TSNeverKeyword(_)
255-
| Self::TSNullKeyword(_) | Self::TSNumberKeyword(_) | Self::TSObjectKeyword(_) | Self::TSStringKeyword(_)
256-
| Self::TSSymbolKeyword(_) | Self::TSUndefinedKeyword(_) | Self::TSUnknownKeyword(_) | Self::TSVoidKeyword(_)
257-
| Self::TSIndexedAccessType(_) | Self::TSInferType(_) | Self::TSIntersectionType(_) | Self::TSLiteralType(_)
258-
| Self::TSMethodSignature(_) | Self::TSTemplateLiteralType(_) | Self::TSThisType(_) | Self::TSTypeLiteral(_)
259-
| Self::TSTypeReference(_) | Self::TSUnionType(_))
255+
matches!(self, Self::TSAnyKeyword(_) | Self::TSBigIntKeyword(_) | Self::TSBooleanKeyword(_) | Self::TSIntrinsicKeyword(_)
256+
| Self::TSNeverKeyword(_) | Self::TSNullKeyword(_) | Self::TSNumberKeyword(_) | Self::TSObjectKeyword(_)
257+
| Self::TSStringKeyword(_) | Self::TSSymbolKeyword(_) | Self::TSUndefinedKeyword(_) | Self::TSUnknownKeyword(_)
258+
| Self::TSVoidKeyword(_) | Self::TSIndexedAccessType(_) | Self::TSInferType(_) | Self::TSIntersectionType(_)
259+
| Self::TSLiteralType(_) | Self::TSMethodSignature(_) | Self::TSTemplateLiteralType(_) | Self::TSThisType(_)
260+
| Self::TSTypeLiteral(_) | Self::TSTypeReference(_) | Self::TSUnionType(_))
260261
}
261262

262263
pub fn is_literal(self) -> bool {
@@ -497,6 +498,7 @@ impl<'a> GetSpan for AstKind<'a> {
497498
Self::TSVoidKeyword(x) => x.span,
498499
Self::TSBigIntKeyword(x) => x.span,
499500
Self::TSBooleanKeyword(x) => x.span,
501+
Self::TSIntrinsicKeyword(x) => x.span,
500502
Self::TSNeverKeyword(x) => x.span,
501503
Self::TSNumberKeyword(x) => x.span,
502504
Self::TSObjectKeyword(x) => x.span,
@@ -698,6 +700,7 @@ impl<'a> AstKind<'a> {
698700
Self::TSVoidKeyword(_) => "TSVoidKeyword".into(),
699701
Self::TSBigIntKeyword(_) => "TSBigIntKeyword".into(),
700702
Self::TSBooleanKeyword(_) => "TSBooleanKeyword".into(),
703+
Self::TSIntrinsicKeyword(_) => "TSIntrinsicKeyword".into(),
701704
Self::TSNeverKeyword(_) => "TSNeverKeyword".into(),
702705
Self::TSNumberKeyword(_) => "TSNumberKeyword".into(),
703706
Self::TSObjectKeyword(_) => "TSObjectKeyword".into(),

crates/oxc_ast/src/span.rs

+1
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ impl<'a> GetSpan for TSType<'a> {
549549
Self::TSStringKeyword(t) => t.span,
550550
Self::TSNeverKeyword(t) => t.span,
551551
Self::TSBooleanKeyword(t) => t.span,
552+
Self::TSIntrinsicKeyword(t) => t.span,
552553
Self::TSSymbolKeyword(t) => t.span,
553554
Self::TSBigIntKeyword(t) => t.span,
554555
Self::TSThisType(t) => t.span,

crates/oxc_ast/src/visit/visit.rs

+11
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@ pub trait Visit<'a>: Sized {
713713
walk_ts_boolean_keyword(self, ty);
714714
}
715715

716+
fn visit_ts_intrinsic_keyword(&mut self, ty: &TSIntrinsicKeyword) {
717+
walk_ts_intrinsic_keyword(self, ty);
718+
}
719+
716720
fn visit_ts_never_keyword(&mut self, ty: &TSNeverKeyword) {
717721
walk_ts_never_keyword(self, ty);
718722
}
@@ -2690,6 +2694,7 @@ pub mod walk {
26902694
TSType::TSAnyKeyword(ty) => visitor.visit_ts_any_keyword(ty),
26912695
TSType::TSBigIntKeyword(ty) => visitor.visit_ts_big_int_keyword(ty),
26922696
TSType::TSBooleanKeyword(ty) => visitor.visit_ts_boolean_keyword(ty),
2697+
TSType::TSIntrinsicKeyword(ty) => visitor.visit_ts_intrinsic_keyword(ty),
26932698
TSType::TSNeverKeyword(ty) => visitor.visit_ts_never_keyword(ty),
26942699
TSType::TSNullKeyword(ty) => visitor.visit_ts_null_keyword(ty),
26952700
TSType::TSNumberKeyword(ty) => visitor.visit_ts_number_keyword(ty),
@@ -3069,6 +3074,12 @@ pub mod walk {
30693074
visitor.leave_node(kind);
30703075
}
30713076

3077+
pub fn walk_ts_intrinsic_keyword<'a, V: Visit<'a>>(visitor: &mut V, ty: &TSIntrinsicKeyword) {
3078+
let kind = AstKind::TSIntrinsicKeyword(visitor.alloc(ty));
3079+
visitor.enter_node(kind);
3080+
visitor.leave_node(kind);
3081+
}
3082+
30723083
pub fn walk_ts_never_keyword<'a, V: Visit<'a>>(visitor: &mut V, ty: &TSNeverKeyword) {
30733084
let kind = AstKind::TSNeverKeyword(visitor.alloc(ty));
30743085
visitor.enter_node(kind);

crates/oxc_codegen/src/gen.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2662,6 +2662,7 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSType<'a> {
26622662
Self::TSAnyKeyword(_) => p.print_str(b"any"),
26632663
Self::TSBigIntKeyword(_) => p.print_str(b"bigint"),
26642664
Self::TSBooleanKeyword(_) => p.print_str(b"boolean"),
2665+
Self::TSIntrinsicKeyword(_) => p.print_str(b"intrinsic"),
26652666
Self::TSNeverKeyword(_) => p.print_str(b"never"),
26662667
Self::TSNullKeyword(_) => p.print_str(b"null"),
26672668
Self::TSNumberKeyword(_) => p.print_str(b"number"),

crates/oxc_parser/src/ts/types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ impl<'a> ParserImpl<'a> {
476476
self.bump_any();
477477
Some(self.ast.ts_never_keyword(self.end_span(span)))
478478
}
479+
Kind::Intrinsic => {
480+
self.bump_any();
481+
Some(self.ast.ts_intrinsic_keyword(self.end_span(span)))
482+
}
479483
_ => None,
480484
}
481485
}

crates/oxc_prettier/src/format/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ impl<'a> Format<'a> for TSType<'a> {
655655
TSType::TSAnyKeyword(v) => v.format(p),
656656
TSType::TSBigIntKeyword(v) => v.format(p),
657657
TSType::TSBooleanKeyword(v) => v.format(p),
658+
TSType::TSIntrinsicKeyword(v) => v.format(p),
658659
TSType::TSNeverKeyword(v) => v.format(p),
659660
TSType::TSNullKeyword(v) => v.format(p),
660661
TSType::TSNumberKeyword(v) => v.format(p),
@@ -709,6 +710,12 @@ impl<'a> Format<'a> for TSBooleanKeyword {
709710
}
710711
}
711712

713+
impl<'a> Format<'a> for TSIntrinsicKeyword {
714+
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
715+
Doc::Str("intrinsic")
716+
}
717+
}
718+
712719
impl<'a> Format<'a> for TSNeverKeyword {
713720
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
714721
Doc::Str("never")

crates/oxc_traverse/src/traverse.rs

+15
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,21 @@ pub trait Traverse<'a> {
17271727
#[inline]
17281728
fn exit_ts_never_keyword(&mut self, node: &mut TSNeverKeyword, ctx: &mut TraverseCtx<'a>) {}
17291729

1730+
#[inline]
1731+
fn enter_ts_intrinsic_keyword(
1732+
&mut self,
1733+
node: &mut TSIntrinsicKeyword,
1734+
ctx: &mut TraverseCtx<'a>,
1735+
) {
1736+
}
1737+
#[inline]
1738+
fn exit_ts_intrinsic_keyword(
1739+
&mut self,
1740+
node: &mut TSIntrinsicKeyword,
1741+
ctx: &mut TraverseCtx<'a>,
1742+
) {
1743+
}
1744+
17301745
#[inline]
17311746
fn enter_ts_unknown_keyword(&mut self, node: &mut TSUnknownKeyword, ctx: &mut TraverseCtx<'a>) {
17321747
}

0 commit comments

Comments
 (0)