Created
December 15, 2019 11:07
-
-
Save WimJongeneel/e1f9be1d56e883cf3ae51e5b63df6821 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 Blog { id: number, title: string } | |
// Will be { id: number, title: string } | { errorMessage: string } | |
let httpResult: any = /* API logic. */ | |
let result = httpResult.errorMesage | |
? new Error(httpResult.errorMessage) | |
: ({ id: httpResult.Id, title: httpResult.Title }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment