Skip to content

@ts-self-types in generated .js #1502

@pcarrier

Description

@pcarrier

💡 Feature description

When generating Deno bindings (maybe all bindings?), it would be great if the generated JS file included a @ts-self-types comment. This would let Deno tooling access type definitions automatically.

💻 Basic example

Instead of myproject.js starting with:



function addToExternrefTable0(obj) {
    const idx = wasm.__externref_table_alloc();
    wasm.__wbindgen_export_2.set(idx, obj);
    return idx;
}

It would start with:

// @ts-self-types="./myproject.d.ts"

function addToExternrefTable0(obj) {
    const idx = wasm.__externref_table_alloc();
    wasm.__wbindgen_export_2.set(idx, obj);
    return idx;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions