Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions types/ember-data/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ export namespace DS {
* invoking the callback with the name of each relationship and its relationship
* descriptor.
*/
eachRelationship(
callback: (name: string, details: RelationshipMeta<this>) => void,
eachRelationship<T extends Model>(
this: T,
callback: (name: string, details: RelationshipMeta<T>) => void,
binding?: any
): any;
/**
Expand Down
2 changes: 1 addition & 1 deletion types/ember-data/test/relationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ p.eachRelationship((n, meta) => {
let m: 'belongsTo' | 'hasMany' = meta.kind;
});

class Comment extends DS.Model {
export class Comment extends DS.Model {
author = DS.attr('string');
}

Expand Down
5 changes: 3 additions & 2 deletions types/ember-data/test/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import DS from 'ember-data';
import { assertType } from './lib/assert';
import { Comment } from './relationships';

declare const store: DS.Store;

Expand Down Expand Up @@ -119,7 +120,7 @@ const MyRouteAsync = Ember.Route.extend({
const store = this.get('store');
return await store.findRecord('post-comment', 1);
},
async afterModel(): Promise<Ember.Array<PostComment>> {
async afterModel(): Promise<Ember.Array<Comment>> {
const post = await this.get('store').findRecord('post', 1);
return await post.get('comments');
}
Expand All @@ -132,7 +133,7 @@ class MyRouteAsyncES6 extends Ember.Route {
async model(): Promise<DS.Model> {
return await this.store.findRecord('post-comment', 1);
}
async afterModel(): Promise<Ember.Array<PostComment>> {
async afterModel(): Promise<Ember.Array<Comment>> {
const post = await this.store.findRecord('post', 1);
return await post.get('comments');
}
Expand Down
2 changes: 1 addition & 1 deletion types/ember-data/v2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ export namespace DS {
* invoking the callback with the name of each relationship and its relationship
* descriptor.
*/
eachRelationship(callback: (name: string, details: RelationshipMeta<this>) => void, binding?: any): any;
eachRelationship<T extends Model>(this: T, callback: (name: string, details: RelationshipMeta<T>) => void, binding?: any): any;
/**
* Represents the model's class name as a string. This can be used to look up the model's class name through
* `DS.Store`'s modelFor method.
Expand Down
2 changes: 1 addition & 1 deletion types/ember-data/v2/test/relationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ p.eachRelationship((n, meta) => {
let m: 'belongsTo' | 'hasMany' = meta.kind;
});

class Comment extends DS.Model {
export class Comment extends DS.Model {
author = DS.attr('string');
}

Expand Down
5 changes: 3 additions & 2 deletions types/ember-data/v2/test/store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import DS from 'ember-data';
import { assertType } from './lib/assert';
import { Comment } from './relationships';

declare const store: DS.Store;

Expand Down Expand Up @@ -119,7 +120,7 @@ const MyRouteAsync = Ember.Route.extend({
const store = this.get('store');
return await store.findRecord('post-comment', 1);
},
async afterModel(): Promise<Ember.Array<PostComment>> {
async afterModel(): Promise<Ember.Array<Comment>> {
const post = await this.get('store').findRecord('post', 1);
return await post.get('comments');
}
Expand All @@ -132,7 +133,7 @@ class MyRouteAsyncES6 extends Ember.Route {
async model(): Promise<DS.Model> {
return await this.store.findRecord('post-comment', 1);
}
async afterModel(): Promise<Ember.Array<PostComment>> {
async afterModel(): Promise<Ember.Array<Comment>> {
const post = await this.store.findRecord('post', 1);
return await post.get('comments');
}
Expand Down
2 changes: 1 addition & 1 deletion types/ember/v2/test/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface EditableMixin {
isEditing: boolean;
}

const EditableMixin: Ember.Mixin<EditableMixin, Ember.Route> = Ember.Mixin.create({
const EditableMixin = Ember.Mixin.create<EditableMixin, Ember.Route>({
edit() {
this.get('controller');
console.log('starting to edit');
Expand Down