-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore: refactor store to class #6249
Conversation
88f3f04
to
6b6352b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS review complete.
- I have one major action item to research class field defaults on a prototype
- @runspired to come up with a small repro of the babel+TS issue he's running into
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending getting the identifiers infra getting merged
import { Promise } from 'rsvp'; and use it as a type |
6b6352b
to
614016b
Compare
This reverts commit e356cce.
…/store emberjs#6249 refactored `Store` to a class. As part of this refactoring, `Store#defaultAdapter` was implemented using the `@computed` decorator. Using the `@computed` decorator requires Ember 3.10+. This adds [`ember-decorators-polyfill`](https://github.com/pzuraq/ember-decorators-polyfill) as a dependency to `@ember-data/store` to add support for Ember < 3.10.
…/store Extracted from emberjs#6098 emberjs#6249 refactored `Store` to a class. As part of this refactoring, `Store#defaultAdapter` was implemented using the `@computed` decorator. Using the `@computed` decorator requires Ember 3.10+. This adds [`ember-decorators-polyfill`](https://github.com/pzuraq/ember-decorators-polyfill) as a dependency to `@ember-data/store` to add support for Ember < 3.10.
…/store Extracted from emberjs#6098 emberjs#6249 refactored `Store` to a class. As part of this refactoring, `Store#defaultAdapter` was implemented using the `@computed` decorator. Using the `@computed` decorator requires Ember 3.10+. This adds [`ember-decorators-polyfill`](https://github.com/pzuraq/ember-decorators-polyfill) as a dependency to `@ember-data/store` to add support for Ember < 3.10.
Service.extend
forces us to move all properties onto the prototype in order for them to be type checked, the syntax does not allow for method overloads, and TS struggles to flow expected types through the store methods.This PR refactors the store into a native class, giving us much improved type checking and allowing us to use method overloads.
It surfaced one issue where we expect folks to be able to overwrite
adapter
as a property on the store when extending; however, when using babel+typescript and a class this is transpiled with an automatic initializer tovoid 0
that overwrites anything set viacreate
orextend
. We worked around this by not declaring that particular property and using a (nasty) type cast in the two locations we access it. @rwjblue does not believe this issue of interop ofTS
+babel
+legacy .extend
syntax is something apps will encounter often.This PR builds on #6246 and #6247