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

Add ts-rs cargo feature to derive ts-rs #708

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Add ts-rs cargo feature to derive ts-rs #708

merged 3 commits into from
Jan 6, 2025

Conversation

jtran
Copy link
Contributor

@jtran jtran commented Jan 2, 2025

Part of KittyCAD/modeling-app#4860.

We need to export types to a specific file like ModelingCmd.ts so that .ts file names don't collide with the ones generated in modeling-app.

The _fix_ts_rs: () is used because when ts-rs generates a TS type for an enum variant whose struct has zero fields, it gives the type null. E.g. { tag: "MyVariantName" } & null. When you use this in TS, you can never have a TS value that's both of type { tag: "MyVariantName" } and of type null.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 0.99668% with 298 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@bd2b33a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
modeling-cmds/src/def_enum.rs 0.00% 227 Missing ⚠️
modeling-cmds/src/shared.rs 0.00% 35 Missing ⚠️
modeling-cmds/src/units.rs 0.00% 6 Missing ⚠️
modeling-cmds/src/coord.rs 0.00% 4 Missing ⚠️
modeling-cmds/src/format/gltf.rs 0.00% 4 Missing ⚠️
modeling-cmds/src/format/fbx.rs 0.00% 3 Missing ⚠️
modeling-cmds/src/format/mod.rs 0.00% 3 Missing ⚠️
modeling-cmds/src/format/ply.rs 0.00% 3 Missing ⚠️
modeling-cmds/src/format/stl.rs 0.00% 3 Missing ⚠️
modeling-cmds/src/shared/point.rs 0.00% 3 Missing ⚠️
... and 5 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #708   +/-   ##
=======================================
  Coverage        ?   25.37%           
=======================================
  Files           ?       35           
  Lines           ?     2093           
  Branches        ?        0           
=======================================
  Hits            ?      531           
  Misses          ?     1562           
  Partials        ?        0           
Flag Coverage Δ
unittests 25.37% <0.99%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jtran jtran marked this pull request as ready for review January 4, 2025 00:34
@jtran jtran requested a review from adamchalmers January 6, 2025 14:42
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 this pull request may close these issues.

2 participants