반응형
문제 번역
Hello, World!
Type Challenges에서는 타입 시스템 자체를 사용해 검증을 합니다.
이 챌린지에서는 밑에 코드를 타입 체크 오류 없이 테스트를 통과시키게 만들어야 합니다.
// expected to be string
type HelloWorld = any
// you should make this work
type test = Expect<Equal<HelloWorld, string>>
Take the Challenge
버튼을 클릭해 코딩을 시작하세요! Happy Hacking!
이 챌린지는 Type Challenges에 의해 포팅 되었으며, antfu에 의해 작성되었습니다.
문제
type HelloWorld = any // expected to be a string
이것을
import type { Equal, Expect, NotAny } from '@type-challenges/utils'
type cases = [
Expect<NotAny<HelloWorld>>,
Expect<Equal<HelloWorld, string>>,
]
이 케이스에 통과시키는 간단한 문제입니다.
문제 풀이
type HelloWorld = string
너무 간단해서 풀이에 대한 설명은 따로 없습니다.
반응형
'Typehero Challenge' 카테고리의 다른 글
Typehero Challenge BEGINNER Generic Function Arguments (0) | 2024.07.18 |
---|