Skip to main content

typescript_function_declaration

Attribute Macro typescript_function_declaration 

Source
#[typescript_function_declaration]
Expand description

为 Rust 函数生成 TypeScript 函数声明

§示例

use typescript_macros::typescript_function_declaration;

#[typescript_function_declaration]
fn add(a: u32, b: u32) -> u32 {
    a + b
}

这将生成对应的 TypeScript 函数声明:

function add(a: number, b: number): number;