mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
One more tweak for ember-data; fix parens.
This commit is contained in:
parent
572137414c
commit
93bf0e8fc2
2
types/ember-data/index.d.ts
vendored
2
types/ember-data/index.d.ts
vendored
@ -424,7 +424,7 @@ declare module "ember-data" {
|
||||
* Create a JSON representation of the record, using the serialization
|
||||
* strategy of the store's adapter.
|
||||
*/
|
||||
serialize(options?: {}): {};
|
||||
serialize(options?: { includeId?: boolean }): {};
|
||||
/**
|
||||
* Use [DS.JSONSerializer](DS.JSONSerializer.html) to
|
||||
* get the JSON representation of a record.
|
||||
|
||||
@ -8,7 +8,7 @@ const Person = DS.Model.extend({
|
||||
title: DS.attr({ defaultValue: "The default" }),
|
||||
title2: DS.attr({ defaultValue: () => "The default" }),
|
||||
|
||||
fullName: Ember.computed('firstName', 'lastName', function () {
|
||||
fullName: Ember.computed('firstName', 'lastName', function() {
|
||||
return `${this.get('firstName')} ${this.get('lastName')}`;
|
||||
})
|
||||
});
|
||||
|
||||
@ -18,7 +18,7 @@ post.save().then((saved) => {
|
||||
assertType<Post>(saved);
|
||||
});
|
||||
|
||||
store.findRecord<Post>('post', 1).then(function (post) {
|
||||
store.findRecord<Post>('post', 1).then(function(post) {
|
||||
post.get('title'); // => "Rails is Omakase"
|
||||
post.set('title', 'A new post');
|
||||
post.save(); // => PATCH to '/posts/1'
|
||||
@ -28,13 +28,13 @@ class User extends DS.Model {
|
||||
username = DS.attr('string');
|
||||
}
|
||||
|
||||
store.queryRecord<User>('user', {}).then(function (user) {
|
||||
store.queryRecord<User>('user', {}).then(function(user) {
|
||||
let username = user.get('username');
|
||||
console.log(`Currently logged in as ${username}`);
|
||||
});
|
||||
|
||||
store.findAll('blog-post'); // => GET /blog-posts
|
||||
store.findAll('author', { reload: true }).then(function (authors) {
|
||||
store.findAll('author', { reload: true }).then(function(authors) {
|
||||
authors.getEach('id'); // ['first', 'second']
|
||||
});
|
||||
store.findAll('post', {
|
||||
@ -56,14 +56,14 @@ class Message extends DS.Model {
|
||||
}
|
||||
|
||||
const messages = store.peekAll<Message>('message');
|
||||
messages.forEach(function (message) {
|
||||
messages.forEach(function(message) {
|
||||
message.set('hasBeenSeen', true);
|
||||
});
|
||||
messages.save();
|
||||
|
||||
const people = store.peekAll('person');
|
||||
people.get('isUpdating'); // false
|
||||
people.update().then(function () {
|
||||
people.update().then(function() {
|
||||
people.get('isUpdating'); // false
|
||||
});
|
||||
people.get('isUpdating'); // true
|
||||
@ -79,16 +79,16 @@ const tom = store.query('user', {
|
||||
filter: {
|
||||
email: 'tomster@example.com'
|
||||
}
|
||||
}).then(function (users) {
|
||||
}).then(function(users) {
|
||||
return users.get("firstObject");
|
||||
});
|
||||
|
||||
// GET /users?isAdmin=true
|
||||
const admins = store.query('user', { isAdmin: true });
|
||||
admins.then(function () {
|
||||
admins.then(function() {
|
||||
console.log(admins.get("length")); // 42
|
||||
});
|
||||
admins.update().then(function () {
|
||||
admins.update().then(function() {
|
||||
admins.get('isUpdating'); // false
|
||||
console.log(admins.get("length")); // 123
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user