mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(ast): shorten manual TS defs (#2638)
Does the same thing, just (in my opinion) a little bit more readable.
This commit is contained in:
parent
308b780ff6
commit
6b5723cdbe
8 changed files with 16 additions and 40 deletions
|
|
@ -14,11 +14,8 @@ use serde::Serialize;
|
||||||
|
|
||||||
use super::{jsx::*, literal::*, ts::*};
|
use super::{jsx::*, literal::*, ts::*};
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export interface BindingIdentifier extends Span { type: "Identifier", name: Atom }
|
export interface BindingIdentifier extends Span { type: "Identifier", name: Atom }
|
||||||
export interface IdentifierReference extends Span { type: "Identifier", name: Atom }
|
export interface IdentifierReference extends Span { type: "Identifier", name: Atom }
|
||||||
|
|
|
||||||
|
|
@ -163,11 +163,8 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type RegExpFlags = {
|
export type RegExpFlags = {
|
||||||
G: 1,
|
G: 1,
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,8 @@ use crate::{
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type IndexVec<I, T> = Array<T>;
|
export type IndexVec<I, T> = Array<T>;
|
||||||
"#;
|
"#;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,8 @@ use serde::{Serialize, Serializer};
|
||||||
|
|
||||||
use compact_str::CompactString;
|
use compact_str::CompactString;
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type Atom = string;
|
export type Atom = string;
|
||||||
export type CompactStr = string;
|
export type CompactStr = string;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,8 @@ define_index_type! {
|
||||||
pub struct AstNodeId = usize;
|
pub struct AstNodeId = usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type AstNodeId = number;
|
export type AstNodeId = number;
|
||||||
export type NodeFlags = {
|
export type NodeFlags = {
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,8 @@ define_index_type! {
|
||||||
pub struct ReferenceId = u32;
|
pub struct ReferenceId = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type ReferenceId = number;
|
export type ReferenceId = number;
|
||||||
export type ReferenceFlag = {
|
export type ReferenceFlag = {
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,8 @@ define_index_type! {
|
||||||
pub struct ScopeId = u32;
|
pub struct ScopeId = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type ScopeId = number;
|
export type ScopeId = number;
|
||||||
"#;
|
"#;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,8 @@ define_index_type! {
|
||||||
pub struct SymbolId = u32;
|
pub struct SymbolId = u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg(all(feature = "serde", feature = "wasm"))]
|
||||||
all(feature = "serde", feature = "wasm"),
|
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
|
||||||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
|
|
||||||
)]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
const TS_APPEND_CONTENT: &'static str = r#"
|
const TS_APPEND_CONTENT: &'static str = r#"
|
||||||
export type SymbolId = number;
|
export type SymbolId = number;
|
||||||
export type SymbolFlags = unknown;
|
export type SymbolFlags = unknown;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue