Skip to content

Commit

Permalink
fix(ast): correct TS types for JSX (#5884)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
overlookmotel committed Sep 19, 2024
1 parent 0d10521 commit 66e919e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions crates/oxc_ast/src/ast/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ pub struct JSXClosingFragment {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Tsify))]
#[serde(untagged)]
pub enum JSXElementName<'a> {
/// `<div />`
Expand Down Expand Up @@ -238,7 +237,6 @@ pub struct JSXMemberExpression<'a> {
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
#[cfg_attr(feature = "serialize", derive(Tsify))]
#[serde(untagged)]
pub enum JSXMemberExpressionObject<'a> {
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,
Expand Down
7 changes: 7 additions & 0 deletions crates/oxc_ast/src/ast_impl/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ use oxc_span::{Atom, Span};

use crate::ast::*;

#[cfg(feature = "serialize")]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
"#;

// 1.2 JSX Elements

impl<'a> JSXIdentifier<'a> {
Expand Down

0 comments on commit 66e919e

Please sign in to comment.