Created
April 19, 2019 20:10
-
-
Save TheCubicleBuddha/a72746c062b8386b33b9752d5d15d8c4 to your computer and use it in GitHub Desktop.
In this example, we no longer get a runtime exception because we've communicated our needs.
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
function getUserById(id: number){ | |
// hits a database and returns the value | |
} | |
const guid = "b5f770f2-197c-4bf5-a31f-cfec4f545d06"; | |
const user = getUserById(guid); | |
// ^ Compiler error: Argument of type string is not assignable to parameter of type 'number'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment