From 144c2bc8c1e0e752e10044e3cf15778df50f91c9 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 12 Feb 2018 20:39:05 -0700 Subject: [PATCH] Ember Data: more Snapshot improvements. --- types/ember-data/index.d.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index a2ad80faff..2fcf1c8ed2 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -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( + belongsTo( keyName: L, options?: {} ): Snapshot['record'][L] | string | null | undefined; /** * Returns the current value of a hasMany relationship. */ - hasMany(keyName: L, options?: {}): any[] | undefined; + hasMany( + keyName: L, + options?: { ids: false } + ): Array['record'][L]> | undefined; + hasMany( + keyName: L, + options: { ids: true } + ): Array | undefined; /** * Iterates through all the attributes of the model, calling the passed * function on each attribute.