Aleph-Alpha / ts-rs

Generate TypeScript bindings from Rust types
MIT License
1.08k stars 107 forks source link

add support for top level `as` #288

Closed dr-bonez closed 6 months ago

dr-bonez commented 6 months ago

Goal

This adds support for easily defining a struct or enum's type definition manually at the top level using the as = ".." attribute. This is for symmetry with #286.

Changes

Added type_as to the container attributes, and defined an early-returned implementation for if this attribute is specified

Checklist

NyxCode commented 6 months ago

Hope you guys had a nice easter!

I love it! Seems like a natural extension after supporting #[ts(type = "..")] on types. Thanks @dr-bonez for the PR, and thanks @escritorio-gustavo for taking a look!

escritorio-gustavo commented 6 months ago

Hope you guys had a nice easter!

Thanks! Hope you did as well!