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:
overlookmotel 2024-03-07 16:53:51 +00:00 committed by GitHub
parent 308b780ff6
commit 6b5723cdbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 16 additions and 40 deletions

View file

@ -14,11 +14,8 @@ use serde::Serialize;
use super::{jsx::*, literal::*, ts::*};
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export interface BindingIdentifier extends Span { type: "Identifier", name: Atom }
export interface IdentifierReference extends Span { type: "Identifier", name: Atom }

View file

@ -163,11 +163,8 @@ bitflags! {
}
}
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type RegExpFlags = {
G: 1,

View file

@ -14,11 +14,8 @@ use crate::{
#[cfg(feature = "serde")]
use serde::Serialize;
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type IndexVec<I, T> = Array<T>;
"#;

View file

@ -5,11 +5,8 @@ use serde::{Serialize, Serializer};
use compact_str::CompactString;
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type Atom = string;
export type CompactStr = string;

View file

@ -5,11 +5,8 @@ define_index_type! {
pub struct AstNodeId = usize;
}
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type AstNodeId = number;
export type NodeFlags = {

View file

@ -7,11 +7,8 @@ define_index_type! {
pub struct ReferenceId = u32;
}
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type ReferenceId = number;
export type ReferenceFlag = {

View file

@ -5,11 +5,8 @@ define_index_type! {
pub struct ScopeId = u32;
}
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type ScopeId = number;
"#;

View file

@ -8,11 +8,8 @@ define_index_type! {
pub struct SymbolId = u32;
}
#[cfg_attr(
all(feature = "serde", feature = "wasm"),
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)
)]
#[allow(dead_code)]
#[cfg(all(feature = "serde", feature = "wasm"))]
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
const TS_APPEND_CONTENT: &'static str = r#"
export type SymbolId = number;
export type SymbolFlags = unknown;