Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Conversation

@didinele
Copy link
Contributor

IRouter methods used to return T, but this is incorrect. An IRouter implementation will never be sync, this is HTTP we're talking about.

Copy link
Member

@zaida04 zaida04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general thing, shouldn’t it be Promise<T | unknown>? In the event that the end user does not pass in a generic? Anyways I’ll approve the changes in the event I’m mistaken.

@didinele
Copy link
Contributor Author

didinele commented Feb 26, 2021

A general thing, shouldn’t it be Promise<T | unknown>? In the event that the end user does not pass in a generic? Anyways I’ll approve the changes in the event I’m mistaken.

T | unknown is incorrect, if the user passes number or.. anything into T TS resolves that union into unknown, meaning that the user's generic becomes irrelevant. When the user does not pass anything TS does actually yield Promise<unknown>

@didinele didinele merged commit 0f3d5ed into main Feb 26, 2021
@didinele didinele deleted the fix/irouter-return-types branch February 26, 2021 05:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants