Created
January 30, 2019 20:25
-
-
Save balanza/edb5d2e21f987ca8db4ec8b68cca3df9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const exhaustionCheck = (e: never) => console.log('this will never be executed') | |
const printMobileSafe = (mobile: Mobile) => { | |
if(mobile.status === 'confirmed') { | |
console.log('Your mobile is confirmed!') | |
} else if(mobile.status === 'unconfirmed') { | |
console.warn('Your mobile is not confirmed!') | |
} else { | |
exhaustionCheck(mobile) // <-- you'll get a compilation error here! | |
} | |
} | |
const certified: CertifiedMobile = { status: 'certified', value: '543234531' } | |
printMobileSafe(certified) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment