Merge branch 'master' into update-ckeditor-url

This commit is contained in:
Nathan Shively-Sanders
2019-02-28 07:43:42 -08:00
7 changed files with 13 additions and 10 deletions

View File

@@ -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;
/**

View File

@@ -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');
}

View File

@@ -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;
@@ -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');
}
@@ -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');
}

View File

@@ -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.

View File

@@ -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');
}

View File

@@ -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;
@@ -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');
}
@@ -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');
}

View File

@@ -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');