Last active
March 24, 2021 23:58
-
-
Save maslade/d68d7c6d1b3e0f3167e45778dddd7ef3 to your computer and use it in GitHub Desktop.
This file contains 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
// not great | |
interface IGenericRequest { | |
requestId: string; | |
} | |
interface IGetUserRequest extends IGenericRequest { | |
username: string; | |
} | |
function handler(request: IGenericRequest) { | |
const getUserRequest = request as IGetUserRequest; | |
if (getUserRequest.username && getUserRequest.username.length > 0) { | |
const username = getUserRequest.username; | |
// ...the rest of the handler... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment