Skip to content

Commit 7bc4598

Browse files
committed
fix(ts): fix a bunch of bugs
1 parent b19cc3f commit 7bc4598

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

storage.d.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,27 @@ export class ACL extends BaseObject {
155155
* extension.
156156
*/
157157
export class File extends BaseObject {
158+
id?: string;
159+
createdAt?: Date;
160+
updatedAt?: Date;
161+
158162
constructor(name: string, data: any, type?: string);
159163
static withURL(name: string, url: string): File;
160164
static createWithoutData(objectId: string): File;
161165

162-
destroy(): Promise<void>;
166+
destroy(options?: AuthOptions): Promise<void>;
163167
fetch(fetchOptions?: FetchOptions, options?: AuthOptions): Promise<this>;
168+
get(attr: string): any;
169+
getACL(): ACL;
164170
metaData(): any;
165171
metaData(metaKey: string): any;
166172
metaData(metaKey: string, metaValue: any): any;
167173
name(): string;
168174
ownerId(): string;
169175
url(): string;
170176
save(options?: FileSaveOptions): Promise<this>;
171-
setACL(acl?: ACL): any;
177+
set(key: string, value: any): this;
178+
setACL(acl: ACL): this;
172179
setUploadHeader(key: string, value: string): this;
173180
size(): any;
174181
thumbnailURL(width: number, height: number): string;
@@ -264,9 +271,9 @@ export class Relation extends BaseObject {
264271
* interface.</p>
265272
*/
266273
export class Object extends BaseObject {
267-
id: any;
268-
createdAt: any;
269-
updatedAt: any;
274+
id?: string;
275+
createdAt?: Date;
276+
updatedAt?: Date;
270277
attributes: any;
271278
changed: boolean;
272279
className: string;
@@ -285,7 +292,7 @@ export class Object extends BaseObject {
285292
list: Object[],
286293
options?: Object.SaveAllOptions
287294
): Promise<T>;
288-
static register(klass: Function, name?: string): void;
295+
static register(klass: new (...args: any[]) => Object, name?: string): void;
289296

290297
initialize(): void;
291298
add(attributeName: string, item: any): this;
@@ -407,7 +414,7 @@ declare type Queriable = Object | File;
407414
declare class BaseQuery<T extends Queriable> extends BaseObject {
408415
className: string;
409416

410-
constructor(objectClass: new (...any) => T);
417+
constructor(objectClass: new (...args: any[]) => T);
411418
constructor(objectClass: string);
412419

413420
addAscending(key: string): this;
@@ -481,8 +488,8 @@ declare class BaseQuery<T extends Queriable> extends BaseObject {
481488
* });</pre></p>
482489
*/
483490
export class Query<T extends Queriable> extends BaseQuery<T> {
484-
static or<U extends Queriable>(...querys: Query<U>[]): U;
485-
static and<U extends Queriable>(...querys: Query<U>[]): U;
491+
static or<U extends Queriable>(...querys: Query<U>[]): Query<U>;
492+
static and<U extends Queriable>(...querys: Query<U>[]): Query<U>;
486493
static doCloudQuery<U extends Queriable>(
487494
cql: string,
488495
pvalues?: any,
@@ -492,7 +499,7 @@ export class Query<T extends Queriable> extends BaseQuery<T> {
492499
containedIn(key: string, values: any[]): this;
493500
contains(key: string, substring: string): this;
494501
containsAll(key: string, values: any[]): this;
495-
count(options?: AuthOptions): Promise<T>;
502+
count(options?: AuthOptions): Promise<number>;
496503
descending(key: string): this;
497504
descending(key: string[]): this;
498505
doesNotExist(key: string): this;
@@ -1039,6 +1046,7 @@ export namespace Push {
10391046

10401047
export namespace Cloud {
10411048
function run(name: string, data?: any, options?: AuthOptions): Promise<any>;
1049+
function rpc(name: string, data?: any, options?: AuthOptions): Promise<any>;
10421050
function requestSmsCode(
10431051
data:
10441052
| string

0 commit comments

Comments
 (0)