evaera / roblox-lua-promise

Promise implementation for Roblox
https://eryn.io/roblox-lua-promise/
MIT License
275 stars 74 forks source link

Implement Luau types #84

Closed ghost closed 2 years ago

ghost commented 2 years ago

This PR fully implements Luau types into Promises. I've did quite a lot of testing and it works flawlessly, however I believe just a bit more testing should be done so that the Luau types implementation can be as solidified as possible.

Additional changes:

konstantinepapakonstantinou commented 2 years ago

Thanks, @bubshayz! This is a much needed change.

Full disclosure- I no longer do much work on Roblox but I closely follow the development of Luau. There's a considerable amount of people who are switching back to Luau after switching to Roblox-TS given the immense progress on the language.

I definitely support this PR. Nobody wants to sacrifice their strict type checking to take advantage of asynchronous programming models. I will close #79 once this is merged.

evaera commented 2 years ago

Posted an update on the issue: https://github.com/evaera/roblox-lua-promise/issues/79#issuecomment-1132104384

In short, it seems like Luau might not yet have the tools we need to correctly implement type checking into the Promise module.

ghost commented 2 years ago

Going to close this PR, at the end, I was able to:

However, I wasn't able to get rid of the giant type def structure at the start of the code and directly inline the types property due to some limitations of Luau's type checking but also some parts of the lib it self (a lot of prototype and metatable work so refactoring them was a complete headache), so this marks the problem as unsolved.

Additionally, I wasn't able to properly implement generics since Luau doesn't yet support generic constraints yet.