숫자가 홀수면 true를 반환하라
return true is a number is odd
type LastChar<S extends string>=
S extends `${infer First}${infer Rest}`?
Rest extends ''?First:LastChar<Rest>
:never
type IsOdd<T extends number> =
`${T}` extends `${string}.${string}`?false:
`${T}` extends `${string}e${string}`?false:
LastChar<`${T}`> extends `${1|3|5|7|9}`?true:false
세가지 조건을 확인했다.
1) 소수점이 있는가? -> 맞다면 false 반환
2) e 형태의 표기법인가? -> 맞다면 false 반환
3) 문자열로 나타냈을때 1,3,5,7,9로 끝나는가? -> 맞다면 true 반환
위의 조건에 해당하지 않으면 false 반환