Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andersonbosa/941379bcb0292154b2a17fe964789360 to your computer and use it in GitHub Desktop.
Save andersonbosa/941379bcb0292154b2a17fe964789360 to your computer and use it in GitHub Desktop.
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