Created
December 17, 2021 22:55
-
-
Save akihisa-shimada/7ea4938ae84e5c063cb2df559c425ce3 to your computer and use it in GitHub Desktop.
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
const functionA = <T, U>(bool: boolean, param1: T, param2: U): T | U => { | |
if (bool) return param1; | |
return param2; | |
} | |
const result1 = functionA(true, 1, '文字列'); | |
const result2 = functionA(false, 1, '文字列'); | |
console.log(result1) // 1 | |
console.log(result2) // 文字列 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment