typeshare icon indicating copy to clipboard operation
typeshare copied to clipboard

Allow generated types to be namespaced

Open darrell-roberts opened this issue 1 year ago • 3 comments

Today all generated types will be put in a single module. I'd like to be able to allow types to optionally be defined in separate namespaces/modules.

For example for Typescript.

#[typeshare::typeshare(namespace = mymodule)]
pub struct MyType {
    some_field: String
};

File mymodule.ts

export interface MyType {
    someField: string
}

darrell-roberts avatar Mar 03 '23 18:03 darrell-roberts

Just came here to create the same Feature Request. :)

lukaszlew avatar Oct 13 '23 21:10 lukaszlew

I have an approach that generates module files per source crate: https://github.com/darrell-roberts/typeshare/pull/4. This is a prototype right now. There are further changes that would have to be made to make this an add on feature so no to impact existing behavior.

darrell-roberts avatar Apr 07 '24 22:04 darrell-roberts

Moved to MR https://github.com/1Password/typeshare/pull/166

darrell-roberts avatar Apr 14 '24 18:04 darrell-roberts