Sha256: 1622c29b0d93a884bd0b5b2a62107a594e2919758c80592566e7786efe788b89

Contents?: true

Size: 992 Bytes

Versions: 30

Compression:

Stored size: 992 Bytes

Contents

# `skip_typescript`

By default, Rust exports exposed to JavaScript will generate TypeScript definitions (unless `--no-typescript` is used). The `skip_typescript` attribute can be used to disable type generation per function, enum, struct, or field. For example:

```rust
#[wasm_bindgen(skip_typescript)]
pub enum MyHiddenEnum {
    One,
    Two,
    Three
}

#[wasm_bindgen]
pub struct MyPoint {
    pub x: u32,

    #[wasm_bindgen(skip_typescript)]
    pub y: u32,
}

#[wasm_bindgen]
impl MyPoint {

    #[wasm_bindgen(skip_typescript)]
    pub fn stringify(&self) -> String {
        format!("({}, {})", self.x, self.y)
    }
}
```

Will generate the following `.d.ts` file:

```ts
/* tslint:disable */
/* eslint-disable */
export class MyPoint {
  free(): void;
  x: number;
}
```

When combined with [the `typescript_custom_section` attribute](typescript_custom_section.html), this can be used to manually specify more specific function types instead of using the generated definitions.

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-22.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-21.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-20.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-20.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-18.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-17.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-17.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-16.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-15.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-15.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-14.0.4 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-14.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-14.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-14.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-13.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-12.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-12.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-11.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md
wasmtime-10.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-rust-exports/skip_typescript.md