adhoc fix js-data/js-data.d.ts and js-data-http/js-data-http-tests.ts

This commit is contained in:
vvakame 2015-09-03 21:10:37 +09:00
parent 35da2f0db2
commit e02dc634d6
2 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ ADocument.inject({ id: 5, author: 'John' });
ADocument.inject({ id: 6, author: 'John' });
// bypass the data store
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
adapter.updateAll<{ id?: number; author: string; }>(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
documents[0]; // { id: 5, author: 'Johnny' }
// The updated documents have NOT been injected into the data store because we bypassed the data store
@ -37,7 +37,7 @@ adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(func
});
// Normally you would just go through the data store
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
ADocument.updateAll<{ id?: number; author: string; }>({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
documents[0]; // { id: 5, author: 'Johnny' }
// the updated documents have been injected into the data store
@ -164,4 +164,4 @@ ADocument.create({ author: 'John' }).then(function (document:any) {
// the new document has been injected into the data store
ADocument.get(document.id); // { id: 5, author: 'John' }
});
});

View File

@ -153,7 +153,7 @@ declare module JSData {
findAll<T>(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
loadRelations<T>(idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
update<T>(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
updateAll<T>(attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
updateAll<T>(attrs:Object, params?:DSFilterParams & T, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
reap(resourceNametions?:DSConfiguration):JSDataPromise<any>;
refresh<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
save<T>(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
@ -283,7 +283,7 @@ declare module JSData {
update<T>(config:DSResourceDefinition<T>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise<T>;
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams & T, options?:DSConfiguration):JSDataPromise<T[]>;
}
}
@ -297,4 +297,4 @@ declare var JSData:{
declare module 'js-data' {
export = JSData;
}
}