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

Upgrading to use ts-rs 10.0.0 #394

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Upgrading to use ts-rs 10.0.0 #394

merged 3 commits into from
Nov 7, 2024

Conversation

dessalines
Copy link
Member

This upgrades to the newest version of ts-rs.

I also added a back-end check on the lemmy PR to make sure there are no nulls now, only optionals.

@dessalines dessalines marked this pull request as draft November 3, 2024 00:58
@Nutomic
Copy link
Member

Nutomic commented Nov 5, 2024

Looks like everything changed from interface to type. Also comments are included now, thats good.

@dessalines
Copy link
Member Author

Ya the comments are a huge bonus. The interface vs type thing isn't too important for our purposes, both work.

@dessalines dessalines marked this pull request as ready for review November 6, 2024 15:51
@dessalines
Copy link
Member Author

K this is ready for review now.

pushd ../lemmy/scripts
./test.sh
pushd ../lemmy
cargo test --workspace export_bindings
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a way to generate the bindings without actually running the tests.

/**
* Adds an admin to a site.
*/
export type AddAdmin = { person_id: PersonId; added: boolean };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-rs now uses types instead of interfaces, but we get comments now 🥳

@@ -73,6 +74,7 @@ export { CustomEmojiId } from "./types/CustomEmojiId";
export { CustomEmojiKeyword } from "./types/CustomEmojiKeyword";
export { CustomEmojiResponse } from "./types/CustomEmojiResponse";
export { CustomEmojiView } from "./types/CustomEmojiView";
export { DbUrl } from "./types/DbUrl";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should DbUrl and SensitiveString be exposed as types for this? They're both just aliases for string anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its what ts-rs generates. Its not really worth it to try to rewrite the wrapper types ts(as....) on the back end, especially since these are just simple aliases.

@dessalines dessalines merged commit c154565 into main Nov 7, 2024
2 checks passed
@SleeplessOne1917 SleeplessOne1917 deleted the ts_rs_upgrade branch November 7, 2024 18:01
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.

3 participants