๐Ÿ’™ Type Challenges/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>>,
]

 

 

 ์ถœ์ฒ˜

https://github.com/type-challenges/type-challenges/blob/main/questions/00013-warm-hello-world/README.ko.md

 

 

๋ฐ˜์‘ํ˜•

'๐Ÿ’™ Type Challenges > type-challenges' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[TS] type-challenges: 18. Length of Tuple  (0) 2023.07.05
[TS] type-challenges: 14. First of Array  (0) 2023.07.04
[TS] type-challenges : 11. Tuple to Object  (0) 2023.07.03
[TS] type-challenges : 7. Readonly  (0) 2023.06.28
[TS] type-challenges : 4. Pick  (0) 2023.06.28