adopted-ember-addons / adopted-ember-addons/ember-changeset

[Typescript] Incorrect return type of functions `changeset` and `Changeset`

Aperta
#648 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
425
Fork
136
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

```ts
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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.