Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird TypeScript behavior of promiseHash #272

Open
KubaJastrz opened this issue Nov 7, 2023 · 1 comment
Open

Weird TypeScript behavior of promiseHash #272

KubaJastrz opened this issue Nov 7, 2023 · 1 comment

Comments

@KubaJastrz
Copy link

Describe the bug

When I'm manipulating the promise inside of the promiseHash, it breaks the typesafety and resolves my promise to unknown

Example code:

const { works, broken } = await promiseHash({
	works: Promise.resolve(42),
	broken: Promise.resolve(42).then((x) => x),
});

Your Example Website or App

https://www.typescriptlang.org/play?#code/PQKgBAyglgtgDgGwKZiQDwIb2WEwBQ+AxgPYB2AzgC5gDeYA7iQE4DWFANGAEbMmtIyYAL5gAvGAwMMUGnD4woFJAAkMFABYAKWvgCQTNhQBcYAAoKlSAHTMkFEggBuSLQBYATAEoO+3v0FTCxJFZVt7Rxd3b2sqDUEtLTQvcQA+MGT8YS9CfFAwAFkWFHQsRHtcAnwAMwBXMiIqKHIwGAwBYNDXFN0wMDsqWuYhTqtwh2dXAG0ARi4PLgBmAF0c4VzSShpmKRnxVvakUeUtHOBgPr6APQB+Qk3qfqkPfbaOyxOvWPiyLQATDBUDBpMAAoFnC6XW73ciPHYMRavQ7HbrfBJg4FidIY6xtOBaWRIGAgwkwLwQy5gaGEc5gDTqDR7JRgapQMhIYiwmj0zR7CTyEJWNSaHRgMi1GDcJDMEwHd6Cz4iClQu55C48jQvZn+ARkTlbOkMl78j6qBmi8WS6Wyt5HU2nNG-DEgjEpbJqynU2kaxHavi6-WPH37AVdYXaeiWqUy0y2lEOuLowGY7HJ3EYfGkklUInkpUelUbLmMFisDB8ep-PlgUNC82RiXR2Xwvbu2mFwM0QxlitkP7Gmum8MWxvW0zwl5tyHXVUPLul8skSuIk0Ks0ihtWmNPBH59sz3L5AAygPsNFg5RggiBTRaWjsijQAFpak0EBQAAIAdmsM2sAAYUjwQh0DgFgaCoABPOAUBRcN9gAJSQUhmD+AAeahmDZABzLgUTQ+pWDIEgGDIVJUgAbnwUDwLAKCYLAABBaRCT+OCGTQ+D0BzPsKHMIcGXSCRekuKYAGkkEgsA2TAARIJIaowHDZZTGYmQc3Q8NxMk5ZKKyKiaOYGg-mQhByxQOoGlvIRa2UcNOIZVA0B4v4+PYzRUi0DVTHDLwglNNC1NY9yNAcjy9KAA

Steps to Reproduce the Bug or Issue

Go to playground & check hash2 and hash3 variable types.

Expected behavior

I should be able to manipulate the promise with .then inside of the promiseHash object.

Screenshots or Videos

No response

Platform

typescript 5.2.2
remix-utils 7.1.0

Additional context

No response

@KubaJastrz
Copy link
Author

It's likely that this is a limitation of TypeScript itself, I'll check if anyone reported anything similar to their issue tracker.

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

No branches or pull requests

1 participant