Last active
July 15, 2020 17:43
-
-
Save dkovacevic15/0cfd95e6c0cad4c5ec60828a85297cb2 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 MisingEmail { | |
status: 400; | |
body: { error: "MISSING_EMAIL"} | |
} | |
interface MissingPassword { | |
status: 400; | |
body: { error: "MISSING_PASSWORD" } | |
} | |
interface InvalidPassword { | |
status: 401; | |
body: { error: "INVALID_PASSWORD" } | |
} | |
interface Success { | |
status: 200; | |
body: { token: string } | |
} | |
type LoginApiResponse = MissingEmail | MissingPassword | InvalidPassword | Success; | |
// Doesn't work, but illustrative of what I want | |
type AxiosApiResponse = Omit<LoginApiResponse, 'body'> & { data: typeof LoginApiResponse.body }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment