π Typescript/type-challenges
[TS] type-challenges : 13. Hello World
μ λ¬
2023. 6. 28. 23:02
λ°μν
λ¬Έμ
Hello, World!
Type Challengesμμλ νμ λ¨μΈ(assertion)μ νκΈ° μν΄ μ체μ μΈ νμ μμ€ν μ μ¬μ©ν©λλ€.
μ΄ κ³Όμ μμλ, μλμ μ½λλ₯Ό λ³κ²½ν΄μ ν μ€νΈ μ½λλ₯Ό ν΅κ³ΌνμΈμ. (νμ μ²΄ν¬ μλ¬ μμ).
// stringμ΄ λμ΄μΌ ν©λλ€.
type HelloWorld = any
// μλμ ν
μ€νΈκ° ν΅κ³Όνλλ‘ λ§λμΈμ.
type test = Expect<Equal<HelloWorld, string>>
Take the Challenge
λ²νΌμ ν΄λ¦ν΄μ μ½λ©μ μμνμΈμ! Happy Hacking!
νμ΄
/* _____________ μ¬κΈ°μ μ½λ μ
λ ₯ _____________ */
type HelloWorld = string // expected to be a string
/* _____________ ν
μ€νΈ μΌμ΄μ€ _____________ */
import type { Equal, Expect, NotAny } from '@type-challenges/utils'
type cases = [
Expect<NotAny<HelloWorld>>,
Expect<Equal<HelloWorld, string>>,
]
μΆμ²
λ°μν