#1666·napi-rs

Using type aliases breaks the typing generation

Author: nobu-shCreated Jul 22, 2023Updated Jun 13, 2026

I have something a long the lines of this:

rust
type ZigZag32 = i32;

#[napi]
pub struct Test {
  pub a: ZigZag32,
}

Which napi is perfectly fine with and happily compiles. But the resulting output for the typings looks like this:

rust
export class Test {
  a: ZigZag32
}

Which at first glance look correct but it doesn't create the type for ZigZag32 it is not a massive issue but I assume it is not intended. We are using custom types for some procedural macros so it would be cool if it just worked :)