Back to Type Challenges

README.Ko

questions/00599-medium-merge/README.ko.md

latest1.9 KB
Original Source
<!--info-header-start--><h1>Merge </h1><blockquote><p>by ZYSzys <a href="https://github.com/ZYSzys" target="_blank">@ZYSzys</a></p></blockquote><p><a href="https://tsch.js.org/599/play/ko" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

두개의 타입을 새로운 타입으로 병합하세요. 두번째 타입의 Key가 첫번째 타입을 덮어씁니다(재정의합니다)

예시:

ts
type foo = {
  name: string
  age: string
}
type coo = {
  age: number
  sex: string
}

type Result = Merge<foo, coo> // expected to be {name: string, age: number, sex: string}
<!--info-footer-start-->

<a href="../../README.ko.md" target="_blank"></a> <a href="https://tsch.js.org/599/answer/ko" target="_blank"></a> <a href="https://tsch.js.org/599/solutions" target="_blank"></a> <!--info-footer-end-->