Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc comments are not included in TS output #14

Open
sisou opened this issue Mar 7, 2023 · 1 comment · May be fixed by #32
Open

Rustdoc comments are not included in TS output #14

sisou opened this issue Mar 7, 2023 · 1 comment · May be fixed by #32

Comments

@sisou
Copy link

sisou commented Mar 7, 2023

Hi! I want to use tsify to generate types (duh :D) for a public API, and I would like my rustdoc comments on my structs and fields to transport over to the TS definitions.

E.g. I have

/// JSON-compatible and human readable format of transactions. E.g. addresses are presented in their human-readable
/// format and address types and the network are represented as strings. Data and proof are serialized as an object
/// describing their contents.
#[derive(serde::Serialize, serde::Deserialize, Tsify)]
#[serde(rename_all = "camelCase")]
pub struct PlainTransaction {
    /// The transaction's unique hash, used as its identifier. Sometimes also called `txId`.
    pub transaction_hash: String,

    // [...]
}

but unfortunately the generated TS types don't include those doc comments:

export interface PlainTransaction {
    transactionHash: string;
}

I would like the output to be this instead:

/**
 * JSON-compatible and human readable format of transactions. E.g. addresses are presented in their human-readable
 * format and address types and the network are represented as strings. Data and proof are serialized as an object
 * describing their contents.
 */
export interface PlainTransaction {
    /**
     * The transaction's unique hash, used as its identifier. Sometimes also called `txId`.
     */
    transactionHash: string;
}

wasm-bindgen does this, it converts the rustdoc into JSDoc annotations.

Is this complicated?

@sisou sisou linked a pull request Aug 14, 2023 that will close this issue
2 tasks
@rouzwelt
Copy link

I was just about to open an issue for this, it would be great to get this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants