Skip to content

Instantly share code, notes, and snippets.

@JaykeOps
Created July 9, 2018 14:21
Show Gist options
  • Save JaykeOps/aa33b3630614ca3e1ca73ac06b34839e to your computer and use it in GitHub Desktop.
Save JaykeOps/aa33b3630614ca3e1ca73ac06b34839e to your computer and use it in GitHub Desktop.
Twitten Example 1
function createUser(uname: string, pw: string): User {
if (!(uname && pw))
throw new Error("Validation failed!");
return { username: uname, password: pw };
}
try {
createUser("John Doe", "hello123");
} catch (error) {
throw error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment