From e09e8626cf82a616a84a8a6437b1bb9a54dff5d1 Mon Sep 17 00:00:00 2001 From: tacheometry <39647014+tacheometry@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:13:26 +0300 Subject: [PATCH 1/2] Promise.fromEvent takes all of the signal's parameters Promise.fromEvent's predicate only took the first parameter from the RBXScriptSignal. Now it should take all of them. Before: https://roblox-ts.com/playground/#code/JYWwDg9gTgLgBAbzgWQIZQNYFMZgDaoDGWAyllAG7DFwC+cAZlBCHAEQACUARgB4wBnAPQDyVYgLYBuAFAyACsxDBRAOiYsAohSwA7GAAo0mHPiKkx1LKsUswMAOKoQWeagED5AVyiEAFu5YAGLAuip+WAAmADRwBmYAnuSxAObOru4CAJIxcADu7t6+AaKRAJRwALwAfIgyAJBCQnBpLm4eOXCoupH5hT7+gb3oWHC6EPBgmVENUDg+unAwUF5YsrRlMkA ```ts import { MarketplaceService } from "@rbxts/services"; Promise.fromEvent(MarketplaceService.PromptGamePassPurchaseFinished, (player, gamePassId, wasPurchased) => { // gamePassId and wasPurchased are not passed return true; }) ``` Now, `gamePassId` and `wasPurchased` should be passed. --- types/Promise.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/Promise.d.ts b/types/Promise.d.ts index 7789335..aea010f 100644 --- a/types/Promise.d.ts +++ b/types/Promise.d.ts @@ -570,12 +570,12 @@ interface PromiseConstructor { * end) * ``` */ - fromEvent(this: void, event: RBXScriptSignal<(value: T) => void>, predicate?: (value: T) => boolean): Promise; + fromEvent(this: void, event: RBXScriptSignal<(...values: T) => void>, predicate?: (...values: T) => boolean): Promise; fromEvent(this: void, event: RBXScriptSignal<() => void>, predicate?: () => boolean): Promise; - fromEvent( + fromEvent( this: void, - event: { Connect: (callback: (value: T) => void) => void }, - predicate?: (value: T) => boolean, + event: { Connect: (callback: (...values: T) => void) => void }, + predicate?: (...values: T) => boolean, ): Promise; /** Checks whether the given object is a Promise via duck typing. This only checks if the object is a table and has an `andThen` method. */ From a90f0860ab07f1fab4ec4da9135795bdad12ae05 Mon Sep 17 00:00:00 2001 From: tacheometry <39647014+tacheometry@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:16:39 +0300 Subject: [PATCH 2/2] Fix array formatting --- types/Promise.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/Promise.d.ts b/types/Promise.d.ts index aea010f..2d4874f 100644 --- a/types/Promise.d.ts +++ b/types/Promise.d.ts @@ -570,9 +570,9 @@ interface PromiseConstructor { * end) * ``` */ - fromEvent(this: void, event: RBXScriptSignal<(...values: T) => void>, predicate?: (...values: T) => boolean): Promise; + fromEvent>(this: void, event: RBXScriptSignal<(...values: T) => void>, predicate?: (...values: T) => boolean): Promise; fromEvent(this: void, event: RBXScriptSignal<() => void>, predicate?: () => boolean): Promise; - fromEvent( + fromEvent>( this: void, event: { Connect: (callback: (...values: T) => void) => void }, predicate?: (...values: T) => boolean,