Closed canrozanes closed 1 year ago
Just upgraded to v5.0.0.beta9 and noticed an issue with types that has to do with registering fragments in FragmentRegistry.
Say I have the following
// app/models/address.ts import Fragment from 'ember-data-model-fragments/fragment'; import { attr } from '@ember-data/model'; export default class Address extends Fragment { @attr('string') declare street: string; @attr('string') declare city: string; }
And then consume the fragment above, in the model below
// app/models/person.js import Model, { attr } from 'ember-data/model'; import { fragment } from 'ember-data-model-fragments/attributes'; import Address from 'app/models/address' export default Person extends Model { @attr('string') declare name: string; @fragment('address') declare address: Address; }
I should get a type error on `@fragment('address') because I forgot to register my fragment with the following syntax:
declare module 'ember-data-model-fragments/types/registries/fragment' { export default interface FragmentRegistry { address: AddressFragment; } }
If ember data is our example, the syntax error should read:
Argument of type '"address"' is not assignable to parameter of type 'keyof FragmentRegistry'.
However, currently I get no errors.
Just upgraded to v5.0.0.beta9 and noticed an issue with types that has to do with registering fragments in FragmentRegistry.
Say I have the following
And then consume the fragment above, in the model below
I should get a type error on `@fragment('address') because I forgot to register my fragment with the following syntax:
If ember data is our example, the syntax error should read:
However, currently I get no errors.