Skip to content

Commit 66e919e

Browse files
committed
fix(ast): correct TS types for JSX (#5884)
Part of #5354. #5882 and #5883 corrected the JSON AST for JSX types to make it ESTree-compatible. Bring the TS types into line with those changes.
1 parent 0d10521 commit 66e919e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

crates/oxc_ast/src/ast/jsx.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ pub struct JSXClosingFragment {
168168
#[ast(visit)]
169169
#[derive(Debug)]
170170
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
171-
#[cfg_attr(feature = "serialize", derive(Tsify))]
172171
#[serde(untagged)]
173172
pub enum JSXElementName<'a> {
174173
/// `<div />`
@@ -238,7 +237,6 @@ pub struct JSXMemberExpression<'a> {
238237
#[ast(visit)]
239238
#[derive(Debug)]
240239
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
241-
#[cfg_attr(feature = "serialize", derive(Tsify))]
242240
#[serde(untagged)]
243241
pub enum JSXMemberExpressionObject<'a> {
244242
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,

crates/oxc_ast/src/ast_impl/jsx.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ use oxc_span::{Atom, Span};
66

77
use crate::ast::*;
88

9+
#[cfg(feature = "serialize")]
10+
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
11+
const TS_APPEND_CONTENT: &'static str = r#"
12+
export type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
13+
export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
14+
"#;
15+
916
// 1.2 JSX Elements
1017

1118
impl<'a> JSXIdentifier<'a> {

0 commit comments

Comments
 (0)