Skip to content

Commit 3ed3669

Browse files
authored
fix(estree): Rename JSDocXxxType to TSJSDocXxxType (oxc-project#10358)
Part of oxc-project#9705 Just renamed them, no difference appeared in the coverage ATM. From my understanding, there is a problem with the parser logic for now. I'll try to fix it later.
1 parent 6e6c777 commit 3ed3669

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

crates/oxc_ast/src/ast/ts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,7 @@ pub enum ImportOrExportKind {
16461646
#[ast(visit)]
16471647
#[derive(Debug)]
16481648
#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
1649+
#[estree(rename = "TSJSDocNullableType")]
16491650
pub struct JSDocNullableType<'a> {
16501651
pub span: Span,
16511652
pub type_annotation: TSType<'a>,
@@ -1657,6 +1658,7 @@ pub struct JSDocNullableType<'a> {
16571658
#[ast(visit)]
16581659
#[derive(Debug)]
16591660
#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
1661+
#[estree(rename = "TSJSDocNonNullableType")]
16601662
pub struct JSDocNonNullableType<'a> {
16611663
pub span: Span,
16621664
pub type_annotation: TSType<'a>,
@@ -1666,6 +1668,7 @@ pub struct JSDocNonNullableType<'a> {
16661668
#[ast(visit)]
16671669
#[derive(Debug)]
16681670
#[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)]
1671+
#[estree(rename = "TSJSDocUnknownType")]
16691672
pub struct JSDocUnknownType {
16701673
pub span: Span,
16711674
}

crates/oxc_ast/src/generated/derive_estree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,7 +3329,7 @@ impl ESTree for ImportOrExportKind {
33293329
impl ESTree for JSDocNullableType<'_> {
33303330
fn serialize<S: Serializer>(&self, serializer: S) {
33313331
let mut state = serializer.serialize_struct();
3332-
state.serialize_field("type", &JsonSafeString("JSDocNullableType"));
3332+
state.serialize_field("type", &JsonSafeString("TSJSDocNullableType"));
33333333
state.serialize_field("start", &self.span.start);
33343334
state.serialize_field("end", &self.span.end);
33353335
state.serialize_field("typeAnnotation", &self.type_annotation);
@@ -3341,7 +3341,7 @@ impl ESTree for JSDocNullableType<'_> {
33413341
impl ESTree for JSDocNonNullableType<'_> {
33423342
fn serialize<S: Serializer>(&self, serializer: S) {
33433343
let mut state = serializer.serialize_struct();
3344-
state.serialize_field("type", &JsonSafeString("JSDocNonNullableType"));
3344+
state.serialize_field("type", &JsonSafeString("TSJSDocNonNullableType"));
33453345
state.serialize_field("start", &self.span.start);
33463346
state.serialize_field("end", &self.span.end);
33473347
state.serialize_field("typeAnnotation", &self.type_annotation);
@@ -3353,7 +3353,7 @@ impl ESTree for JSDocNonNullableType<'_> {
33533353
impl ESTree for JSDocUnknownType {
33543354
fn serialize<S: Serializer>(&self, serializer: S) {
33553355
let mut state = serializer.serialize_struct();
3356-
state.serialize_field("type", &JsonSafeString("JSDocUnknownType"));
3356+
state.serialize_field("type", &JsonSafeString("TSJSDocUnknownType"));
33573357
state.serialize_field("start", &self.span.start);
33583358
state.serialize_field("end", &self.span.end);
33593359
state.end();

napi/parser/deserialize-js.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ function deserializeTSInstantiationExpression(pos) {
19641964

19651965
function deserializeJSDocNullableType(pos) {
19661966
return {
1967-
type: 'JSDocNullableType',
1967+
type: 'TSJSDocNullableType',
19681968
start: deserializeU32(pos),
19691969
end: deserializeU32(pos + 4),
19701970
typeAnnotation: deserializeTSType(pos + 8),
@@ -1974,7 +1974,7 @@ function deserializeJSDocNullableType(pos) {
19741974

19751975
function deserializeJSDocNonNullableType(pos) {
19761976
return {
1977-
type: 'JSDocNonNullableType',
1977+
type: 'TSJSDocNonNullableType',
19781978
start: deserializeU32(pos),
19791979
end: deserializeU32(pos + 4),
19801980
typeAnnotation: deserializeTSType(pos + 8),
@@ -1984,7 +1984,7 @@ function deserializeJSDocNonNullableType(pos) {
19841984

19851985
function deserializeJSDocUnknownType(pos) {
19861986
return {
1987-
type: 'JSDocUnknownType',
1987+
type: 'TSJSDocUnknownType',
19881988
start: deserializeU32(pos),
19891989
end: deserializeU32(pos + 4),
19901990
};

napi/parser/deserialize-ts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ function deserializeTSInstantiationExpression(pos) {
20402040

20412041
function deserializeJSDocNullableType(pos) {
20422042
return {
2043-
type: 'JSDocNullableType',
2043+
type: 'TSJSDocNullableType',
20442044
start: deserializeU32(pos),
20452045
end: deserializeU32(pos + 4),
20462046
typeAnnotation: deserializeTSType(pos + 8),
@@ -2050,7 +2050,7 @@ function deserializeJSDocNullableType(pos) {
20502050

20512051
function deserializeJSDocNonNullableType(pos) {
20522052
return {
2053-
type: 'JSDocNonNullableType',
2053+
type: 'TSJSDocNonNullableType',
20542054
start: deserializeU32(pos),
20552055
end: deserializeU32(pos + 4),
20562056
typeAnnotation: deserializeTSType(pos + 8),
@@ -2060,7 +2060,7 @@ function deserializeJSDocNonNullableType(pos) {
20602060

20612061
function deserializeJSDocUnknownType(pos) {
20622062
return {
2063-
type: 'JSDocUnknownType',
2063+
type: 'TSJSDocUnknownType',
20642064
start: deserializeU32(pos),
20652065
end: deserializeU32(pos + 4),
20662066
};

npm/oxc-types/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,19 +1420,19 @@ export interface TSInstantiationExpression extends Span {
14201420
export type ImportOrExportKind = 'value' | 'type';
14211421

14221422
export interface JSDocNullableType extends Span {
1423-
type: 'JSDocNullableType';
1423+
type: 'TSJSDocNullableType';
14241424
typeAnnotation: TSType;
14251425
postfix: boolean;
14261426
}
14271427

14281428
export interface JSDocNonNullableType extends Span {
1429-
type: 'JSDocNonNullableType';
1429+
type: 'TSJSDocNonNullableType';
14301430
typeAnnotation: TSType;
14311431
postfix: boolean;
14321432
}
14331433

14341434
export interface JSDocUnknownType extends Span {
1435-
type: 'JSDocUnknownType';
1435+
type: 'TSJSDocUnknownType';
14361436
}
14371437

14381438
export type AssignmentOperator =

0 commit comments

Comments
 (0)