Skip to content

Bug: Generics are not handled correctly in TypeScript definition output #39

@mattatz

Description

@mattatz

Thank you for updating Tsify project! 😃

I encountered an issue while using the tsify_next::Tsify derive macro.
When defining a struct with generics, the generated TypeScript definition does not handle the generics correctly.

Specifically, when I define:

#[derive(tsify_next::Tsify)]
pub struct Polyline<const D: usize> {
    pub points: Vec<Point<f64, D>>,
}

the index.d.ts file incorrectly outputs:

export interface Polyline {
    points: Point<number, D>[];
}

The generic D is not handled properly, which causes type definition issues in TypeScript.

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