Skip to content

Instantly share code, notes, and snippets.

@subwaymatch
Last active July 14, 2020 18:59
Show Gist options
  • Save subwaymatch/1fde33c1d65fca274e538f1bf2fa6919 to your computer and use it in GitHub Desktop.
Save subwaymatch/1fde33c1d65fca274e538f1bf2fa6919 to your computer and use it in GitHub Desktop.
function addTwoNumbers(num1, num2) {
return num1 + num2;
}
var result = addTwoNumbers('10', 20);
console.log("Result: " + result);
console.log("Return Type: " + typeof result);
// Outputs an error message during compilation
// demo.ts(5,28): error TS2345: Argument of type '"10"' 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