StudyForYou / ouahhan-typescript-with-react

์šฐ์•„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ with ๋ฆฌ์•กํŠธ ์Šคํ„ฐ๋”” ๋ ˆํฌ ๐Ÿงต
4 stars 0 forks source link

๐Ÿ”ฅtype-challenges_06_ 03057 - Push #46

Closed hyeyoonS closed 2 months ago

hyeyoonS commented 2 months ago

Push ์‰ฌ์›€ #array

by jiangshan @jiangshanmeta

๋„์ „ํ•˜๊ธฐ    English ็ฎ€ไฝ“ไธญๆ–‡ ๆ—ฅๆœฌ่ชž

Array.push์˜ ์ œ๋„ค๋ฆญ ๋ฒ„์ „์„ ๊ตฌํ˜„ํ•˜์„ธ์š”.

์˜ˆ์‹œ:

type Result = Push<[1, 2], '3'> // [1, 2, '3']

๋Œ์•„๊ฐ€๊ธฐ ์ •๋‹ต ๊ณต์œ ํ•˜๊ธฐ ์ •๋‹ต ๋ณด๊ธฐ

๊ด€๋ จ๋œ ๋ฌธ์ œ๋“ค

533ใƒปConcat 3060ใƒปUnshift
hyeyoonS commented 2 months ago
type Push<T extends unknown[], U> = [...T, U]
summerkimm commented 2 months ago
type Push<T extends any[], U> = [...T, U]