mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[parse] Fix typo in Parse.Object.save attrs type (#41623)
* [parse] Fix typo in Parse.Object.save attrs type * [parse] Fix typo in Parse.Object.set attrs type
This commit is contained in:
committed by
Eli Barzilay
parent
e6fb7b9391
commit
c04e503e08
4
types/parse/index.d.ts
vendored
4
types/parse/index.d.ts
vendored
@@ -412,7 +412,7 @@ namespace Parse {
|
||||
revert(...keys: Array<Extract<keyof T, string>>): void;
|
||||
save<K extends Extract<keyof T, string>>(
|
||||
attrs?: (((x: T) => void) extends ((x: Attributes) => void) ? Partial<T> : {
|
||||
[key in K]: T[K];
|
||||
[key in K]: T[key];
|
||||
}) | null,
|
||||
options?: Object.SaveOptions
|
||||
): Promise<this>;
|
||||
@@ -423,7 +423,7 @@ namespace Parse {
|
||||
): Promise<this>;
|
||||
set<K extends Extract<keyof T, string>>(
|
||||
attrs: ((x: T) => void) extends ((x: Attributes) => void) ? Partial<T> : {
|
||||
[key in K]: T[K];
|
||||
[key in K]: T[key];
|
||||
},
|
||||
options?: Object.SetOptions
|
||||
): this | false;
|
||||
|
||||
@@ -1109,17 +1109,26 @@ function testObject() {
|
||||
objTyped.revert('other');
|
||||
}
|
||||
|
||||
async function testSave(objUntyped: Parse.Object, objTyped: Parse.Object<{ example: boolean }>) {
|
||||
async function testSave(
|
||||
objUntyped: Parse.Object,
|
||||
objTyped: Parse.Object<{ example: boolean; someString: string }>
|
||||
) {
|
||||
// $ExpectType Object<Attributes>
|
||||
await objUntyped.save({ whatever: 100 });
|
||||
|
||||
// $ExpectType Object<Attributes>
|
||||
await objUntyped.save('whatever', 100);
|
||||
|
||||
// $ExpectType Object<{ example: boolean; }>
|
||||
// $ExpectType Object<{ example: boolean; someString: string; }>
|
||||
await objTyped.save({ example: true });
|
||||
|
||||
// $ExpectType Object<{ example: boolean; }>
|
||||
// $ExpectType Object<{ example: boolean; someString: string; }>
|
||||
await objTyped.save({ example: true, someString: 'hello' });
|
||||
|
||||
// $ExpectError
|
||||
await objTyped.save({ example: 'hello', someString: true });
|
||||
|
||||
// $ExpectType Object<{ example: boolean; someString: string; }>
|
||||
await objTyped.save('example', true);
|
||||
|
||||
// $ExpectError
|
||||
@@ -1145,6 +1154,12 @@ function testObject() {
|
||||
// $ExpectType false | Object<{ example: boolean; another: number; }>
|
||||
objTyped.set({ example: false });
|
||||
|
||||
// $ExpectType false | Object<{ example: boolean; another: number; }>
|
||||
objTyped.set({ example: true, another: 123 });
|
||||
|
||||
// $ExpectError
|
||||
objTyped.set({ example: 123, another: true });
|
||||
|
||||
// $ExpectType false | Object<{ example: boolean; another: number; }>
|
||||
objTyped.set('example', true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user