fix(ast): temporary fix tsify not generating some typings (#2611)

seems like a bug in tsify
This commit is contained in:
Boshen 2024-03-05 14:13:28 +08:00 committed by GitHub
parent 1db307abbf
commit 49778abb80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 33 deletions

View file

@ -12,8 +12,7 @@ use oxc_syntax::{
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::Serialize; use serde::Serialize;
#[allow(clippy::wildcard_imports)] use super::{jsx::*, literal::*, ts::*};
use crate::ast::*;
#[cfg_attr( #[cfg_attr(
all(feature = "serde", feature = "wasm"), all(feature = "serde", feature = "wasm"),

View file

@ -1,25 +0,0 @@
//! [`JSDoc`](https://github.com/microsoft/TypeScript/blob/54a554d8af2657630307cbfa8a3e4f3946e36507/src/compiler/types.ts#L393)
use oxc_span::Span;
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::ast::TSType;
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct JSDocNullableType<'a> {
#[cfg_attr(feature = "serde", serde(flatten))]
pub span: Span,
pub type_annotation: TSType<'a>,
pub postfix: bool,
}
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct JSDocUnknownType {
#[cfg_attr(feature = "serde", serde(flatten))]
pub span: Span,
}

View file

@ -5,8 +5,7 @@ use oxc_span::{Atom, Span};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::Serialize; use serde::Serialize;
#[allow(clippy::wildcard_imports)] use super::{js::*, literal::*, ts::*};
use crate::ast::*;
// 1.2 JSX Elements // 1.2 JSX Elements

View file

@ -1,9 +1,8 @@
//! AST Definitions //! AST Definitions
mod js; mod js;
mod jsdoc;
mod jsx; mod jsx;
mod literal; mod literal;
mod ts; mod ts;
pub use self::{js::*, jsdoc::*, jsx::*, literal::*, ts::*}; pub use self::{js::*, jsx::*, literal::*, ts::*};

View file

@ -8,8 +8,7 @@ use oxc_span::{Atom, GetSpan, Span};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::Serialize; use serde::Serialize;
#[allow(clippy::wildcard_imports)] use super::{js::*, literal::*};
use crate::ast::*;
#[derive(Debug, Hash)] #[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))] #[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
@ -1058,3 +1057,23 @@ impl ImportOrExportKind {
matches!(self, Self::Type) matches!(self, Self::Type)
} }
} }
// [`JSDoc`](https://github.com/microsoft/TypeScript/blob/54a554d8af2657630307cbfa8a3e4f3946e36507/src/compiler/types.ts#L393)
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct JSDocNullableType<'a> {
#[cfg_attr(feature = "serde", serde(flatten))]
pub span: Span,
pub type_annotation: TSType<'a>,
pub postfix: bool,
}
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct JSDocUnknownType {
#[cfg_attr(feature = "serde", serde(flatten))]
pub span: Span,
}