Ember Data: more Snapshot improvements.

This commit is contained in:
Chris Krycho
2018-02-12 20:54:17 -07:00
parent 4ae79aa5e8
commit 144c2bc8c1
+11 -4
View File
@@ -946,22 +946,29 @@ declare module 'ember-data' {
/**
* Returns all attributes and their corresponding values.
*/
attributes(): {};
attributes(): { [L in keyof ModelRegistry[K]]: ModelRegistry[K][L] };
/**
* Returns all changed attributes and their old and new values.
*/
changedAttributes(): {};
changedAttributes(): Partial<{ [L in keyof ModelRegistry[K]]: ModelRegistry[K][L] }>;
/**
* Returns the current value of a belongsTo relationship.
*/
belongsTo<L extends keyof ModelRegistry & keyof ModelRegistry[K]>(
belongsTo<L extends keyof ModelRegistry[K]>(
keyName: L,
options?: {}
): Snapshot<K>['record'][L] | string | null | undefined;
/**
* Returns the current value of a hasMany relationship.
*/
hasMany<L extends keyof ModelRegistry[K]>(keyName: L, options?: {}): any[] | undefined;
hasMany<L extends keyof ModelRegistry[K]>(
keyName: L,
options?: { ids: false }
): Array<Snapshot<K>['record'][L]> | undefined;
hasMany<L extends keyof ModelRegistry[K]>(
keyName: L,
options: { ids: true }
): Array<string> | undefined;
/**
* Iterates through all the attributes of the model, calling the passed
* function on each attribute.