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

[Typescript] Incorrect return type of functions changeset and Changeset #648

Open
bartocc opened this issue Apr 13, 2022 · 0 comments
Open

Comments

@bartocc
Copy link
Contributor

bartocc commented Apr 13, 2022

I might be wrong, but I believe the EmberChangeset return type I used in #641 is not completely correct:
https://github.com/poteto/ember-changeset/blob/aac0b2cecf09acc3be24c55265311fe0fb87a9f6/index.d.ts#L15-L16

If we pass an EmberChangeset subclass to the options param changeset, the return type won't be EmberChangeset, but the subclass.

For example

class MyChangeset extends EmberChangeset {}
const cs = Changeset({foo: "bar"}, () => true, {}, {changeset: MyChangeset})

Then the cs variable will be of type MyChangeset, not EmberChangeset

@kpfefferle Do you agree?

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