Skip to content

Conversation

tacheometry
Copy link

@tacheometry tacheometry commented Oct 24, 2022

Promise.fromEvent's predicate only took the first parameter from the RBXScriptSignal. Now it should take all of them. Before:

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.

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.
@tacheometry
Copy link
Author

Found a bit of an issue, when attaching a then callback, the types are incorrect:

import { MarketplaceService } from "@rbxts/services";

Promise.fromEvent(MarketplaceService.PromptGamePassPurchaseFinished, (player, gamePassId, wasPurchased) => {
	return true;
}).then((a) => {
	// "a" is typed as [player: Player, passId: number, purchased: boolean]
	print(a); // Player1
	print(typeOf(a)); // Instance
	// the return value is not actually an array. Maybe it should be a LuaTuple?
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant