Created
June 4, 2025 00:36
-
-
Save KrishnaPravin/c160bdea9737eb92e19392abf12731d2 to your computer and use it in GitHub Desktop.
Enforce caller to provide generic type, where the generic type is also used as a type of one of the params. This also prevents type inference from the caller's param type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enforce caller to provide generic type, where the generic type is also used as a type of one of the params. | |
// This also prevents type inference from the caller's param type. | |
async sendMessage<T = never, P extends T = T>( | |
param1: string, | |
param2: P | |
) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment