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

Support for generating generic types? #62

Closed
sdboyer opened this issue Sep 13, 2022 · 1 comment
Closed

Support for generating generic types? #62

sdboyer opened this issue Sep 13, 2022 · 1 comment

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Sep 13, 2022

Currently, cuetsy can't generate generic Typescript types.

I'm pretty uncomfortable with the idea of generating generic types in cuetsy, as it's hard to see how we could do so in a way that maintains at least rough type equivalence. It's especially unclear how how generated default* would be reconciled with generics in the raw generated types.

In general, i prefer a "veneering" strategy, where it's expected that hand-written code is layered on top of the generic code that can add generic types. That way, the typescript type checker can enforce that whatever generics are layered on type, they're type constraints/refinements on the generated raw types.

But, i'm open to counterarguments, which folks are welcome to make in this issue, if they want :)

@sdboyer
Copy link
Contributor Author

sdboyer commented Oct 5, 2022

We're now settled against this, primarily because of the default* issue. Veneering is the preferred strategy (see grafana/grafana#54816 for where we introduced it).

Could reopen if someone has something nifty for how we handle defaults, coupled with a strong use case to justify.

@sdboyer sdboyer closed this as completed Oct 5, 2022
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

No branches or pull requests

1 participant