dts
Comptime helpers for generating TypeScript declaration files. The .dts = .auto build option uses these internally; you do not normally call them directly.
napi.dts.generate(comptime Module: type)
Returns the comptime-generated .d.ts string for Module. Walks every public declaration of Module (the same way napi.module does at runtime) and emits TypeScript that mirrors the Zig types.
The result describes both forms emitted by the generated JavaScript facade: named exports and the default addon object used by import addon from "...".
What the walker does:
pub fnbecomes a TypeScript function signature.pub const(with a JS-mappable value) becomes a typed property.- Nested namespaces become nested object types.
napi.Valandnapi.Callbackbecomeunknownand(...args: unknown[]) => unknownrespectively.
For configuration and rules of thumb, see TypeScript declarations.