Created
May 9, 2024 13:17
-
-
Save andersonbosa/941379bcb0292154b2a17fe964789360 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
interface AuthenticationService { | |
authenticate<I, O> (body: I): Promise<O> | |
} | |
class BasicAuthenticationService implements AuthenticationService { | |
async authenticate<I, O> (body: I): Promise<O> { | |
const r = { content: "authenticated" } | |
return r as O | |
} | |
} | |
interface IAuthenticateInput { | |
code: string | |
} | |
interface IAuthenticateOutput { | |
content: string | |
} | |
async function main () { | |
const r = await new BasicAuthenticationService(). | |
authenticate<IAuthenticateInput, IAuthenticateOutput>({ code: "123456" }) | |
console.log(r) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment