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

Don't require 'static #116

Closed
petersn opened this issue Sep 13, 2022 · 2 comments
Closed

Don't require 'static #116

petersn opened this issue Sep 13, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@petersn
Copy link

petersn commented Sep 13, 2022

I see in the docs a todo labeled "don’t require 'static". I assume this is getting at how:

#[derive(ts_rs::TS)]
struct Foo<'a> {
    field: &'a str,
}

fails unless we add the constraint 'a: 'static.

So far ts-rs is really great for helping keep my backend and frontend in sync, but not supporting non-'static lifetimes is a big limiter for my higher performance uses, where I really don't want copies in serde. Is there an ETA on this feature?

Thanks again for creating a great crate, by the way.

-Peter

@petersn
Copy link
Author

petersn commented Sep 14, 2022

Okay, I decided to jump in and see if I could hackily make this work. Here's my attempt:

https://github.com/Aleph-Alpha/ts-rs/pull/117/files

I'd love input if this is even remotely a reasonable way to get ts-rs to support non-'static lifetimes. All of the existing tests pass, and in addition the above example also successfully compiles.

@NyxCode NyxCode added the enhancement New feature or request label Sep 17, 2022
@NyxCode NyxCode linked a pull request Sep 17, 2022 that will close this issue
@escritorio-gustavo
Copy link
Contributor

escritorio-gustavo commented Jan 26, 2024

The docs are outdated on this. Lifetimes were fixed in #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants