diff --git a/Cargo.toml b/Cargo.toml index 0edf092..9d1ee10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["ImJeremyHe"] edition = "2018" name = "gents" -version = "1.3.0" +version = "1.3.1" license = "MIT" description = "generate TypeScript interfaces from Rust code" repository = "https://github.com/ImJeremyHe/gents" diff --git a/derives/Cargo.toml b/derives/Cargo.toml index 1d15f71..cc6686a 100644 --- a/derives/Cargo.toml +++ b/derives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gents_derives" -version = "1.3.0" +version = "1.3.1" description = "provides some macros for gents" authors = ["ImJeremyHe"] license = "MIT" diff --git a/src/descriptor.rs b/src/descriptor.rs index 423f3ff..4146ca2 100644 --- a/src/descriptor.rs +++ b/src/descriptor.rs @@ -456,6 +456,20 @@ impl_builtin!(f64, "number", "f64"); impl_builtin!(String, "string", "string"); impl_builtin!(bool, "boolean", "bool"); +impl TS for () { + fn _register(manager: &mut DescriptorManager, _generic_base: bool) -> usize { + let type_id = TypeId::of::<()>(); + let descriptor = BuiltinTypeDescriptor { + ts_name: "void".to_string(), + }; + manager.registry(type_id, Descriptor::BuiltinType(descriptor)) + } + + fn _ts_name() -> String { + "void".to_string() + } +} + impl TS for Vec { fn _register(manager: &mut DescriptorManager, generic_base: bool) -> usize { let idx = T::_register(manager, generic_base);