Created
January 18, 2021 05:19
-
-
Save hw0k/063093b64c316b0ebe6e26a408c12cc9 to your computer and use it in GitHub Desktop.
TN 6
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 doSomething(left: string | number, right: string | boolean) { | |
if (left === right) { | |
// left와 right가 모두 string으로 추론됨. | |
console.log(left.toLowerCase()); | |
console.log(right.toLowerCase()); | |
return; | |
} | |
// left는 string | number, right는 string | boolean으로 추론됨. | |
console.log(`${left}`); | |
console.log(`${right}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment