diff --git a/README.md b/README.md index de02528..d456b15 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ type Flags = { } (config: { - flags: "Flags"; + flags: Flags; node: HTMLElement; }): void diff --git a/src/typescript.rs b/src/typescript.rs index 9ac3f65..01f6b3d 100644 --- a/src/typescript.rs +++ b/src/typescript.rs @@ -6,6 +6,7 @@ pub enum TSType { Object(BTreeMap), Scalar(&'static str), StringScalar(String), + TypeRef(String), Union(Vec), Function { args: BTreeMap, @@ -59,6 +60,7 @@ impl TSType { out.push_str(string); out.push('"'); } + Self::TypeRef(ref_) => out.push_str(ref_), Self::Union(types) => { for (i, type_) in types.iter().enumerate() { if i != 0 { @@ -113,7 +115,7 @@ impl TSType { } pub fn new_ref(name: String) -> Self { - Self::StringScalar(name) + Self::TypeRef(name) } pub fn to_init(self) -> Self { diff --git a/tests/cmd/generate_ts.md b/tests/cmd/generate_ts.md index 87b2994..6042dba 100644 --- a/tests/cmd/generate_ts.md +++ b/tests/cmd/generate_ts.md @@ -12,7 +12,7 @@ type Flags = { } (config: { - flags: "Flags"; + flags: Flags; node: HTMLElement; }): void