{"id":16949,"date":"2026-07-20T11:35:54","date_gmt":"2026-07-20T02:35:54","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=16949"},"modified":"2026-07-20T11:41:10","modified_gmt":"2026-07-20T02:41:10","slug":"typescript-utility-type%ec%9d%98-%ea%b8%b0%eb%b0%98-%ec%a1%b0%ea%b1%b4%eb%b6%80-%ed%83%80%ec%9e%85conditional-type","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=16949","title":{"rendered":"TypeScript Utility Type\uc758 \uae30\ubc18, \uc870\uac74\ubd80 \ud0c0\uc785(Conditional Type)"},"content":{"rendered":"<p>Conditional Type\uc5d0 \ub300\ud55c \uad6c\uad6c\uc808\uc808\ud55c \ubb38\ubc95\uc744 \uc124\uba85\ud558\ub294 \ub300\uc2e0 Utility Type \uc911 ReturnType\uc758 \uad6c\ud604 \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uace0\uc790 \ud569\ub2c8\ub2e4.<\/p>\n<p>ReturnType\uc740 \uc785\ub825\ub41c \ud568\uc218 \ud0c0\uc785\uc758 \ubc18\ud658 \ud0c0\uc785\uc744 \uc5bb\ub294 TypeScript\uc5d0 \uc774\ubbf8 \uc815\uc758\ub41c API\uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc774 ReturnType\uc740 \ub124\uc774\ud2f0\ube0c\uac00 \uc544\ub2cc TypeScript \uc5b8\uc5b4\ub85c \uc791\uc131\ub41c \ub140\uc11d\uc785\ub2c8\ub2e4. \uc774\ub54c \uc870\uac74\ubd80 \ud0c0\uc785(Conditional Type) \ubb38\ubc95\uc774 \uc0ac\uc6a9\ub418\ub294\ub370\uc694. ReturnType\uc744 \ube44\ub86f\ud55c \ub300\ub2e4\uc218\uc758 Utility Type \ub4e4\uc740 \uc870\uac74\ubd80 \ud0c0\uc785 \ubb38\ubc95\uc744 \ud1b5\ud574 \uad6c\ud604\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>ReturnType\uc758 \uad6c\ud604 \ucf54\ub4dc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4. \uc2e4\uc81c \uad6c\ud604\ub41c \ucf54\ub4dc\uc640 \ub2e4\ub97c \uc218 \uc788\uc73c\ub098 \uacb0\uacfc\ub294 \ub3d9\uc77c\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\ntype MyReturnType&lt;T extends (...args: any) => any> =\r\n  T extends (...args: any) => infer R ? R : any;\r\n<\/pre>\n<p>\uc704\uc758 \ucf54\ub4dc\ub97c \uc0ac\uc6a9\ud55c \ucf54\ub4dc\ub97c \uc608\uc2dc\ub85c \ubcf4\uba74..<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\ntype f = (a: number) => void;\r\ntype rt = MyReturnType&lt;f>\r\n<\/pre>\n<p>f\ub294 void \ud0c0\uc785\uc744 \ubc18\ud658\ud558\ub294 \ud568\uc218 \ud0c0\uc785\uc774\ubbc0\ub85c rt\ub294 void \ud0c0\uc785\uc774 \ub429\ub2c8\ub2e4. \uae30\ub300\ud588\ub358 \uae30\ub2a5\uc785\ub2c8\ub2e4.<\/p>\n<p>\uc774\uc81c MyReturnType\uc5d0 \ub300\ud55c \uad6c\ud604 \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uba74 &#8230;<\/p>\n<p>MyReturnType\uc758 T \uc778\uc790\ub294 <code class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">&lt;T extends (...args: any) => any><\/code>\uc5d0 \uc758\ud574 \ubaa8\ub4e0 \ud568\uc218\uc758 \ud615\ud0dc\ub97c \ud3ec\ud568\ud560 \uc218 \uc788\ub294 \ud568\uc218 \ud0c0\uc785\uc73c\ub85c \uc81c\uc57d \ubc1b\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uadf8\ub9ac\uace0 <code class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">T extends (...args: any) => infer R<\/code>\uc5d0 \uc758\ud574 \ub2e4\uc2dc T\uac00 \uc815\ud574\uc9c4 \uc81c\uc57d \uc870\uac74, \uc989 \uc870\uac74\ubd80 \ud0c0\uc785\uc778\uc9c0\ub97c \uac80\uc0ac\ud558\uace0 \uc788\uace0, \uc870\uac74\ubd80 \ud0c0\uc785 \uac80\uc0ac\ub97c \uc218\ud589\ud560\ub54c <code class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">infer R<\/code>\uc5d0 \uc758\ud574 R\uc5d0 \ub300\ud55c \ud0c0\uc785\uc744 \ucd94\ub860(infer)\ud558\uac8c \ub418\uace0 \uacb0\uacfc\uc801\uc73c\ub85c \uc870\uac74\uc5d0 \ub9de\uc744 \uacbd\uc6b0 \ucd94\ub860\ub41c \ud0c0\uc785\uc778 R\uc774 \ubc18\ud658\ub418\uace0 \uc870\uac74\uc5d0 \ub9de\uc9c0 \uc54a\uc744 \uacbd\uc6b0 <code class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">any<\/code>\uac00 \ubc18\ud658\ub418\ub3c4\ub85d \ud558\ub294 \uac83\uc785\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Conditional Type\uc5d0 \ub300\ud55c \uad6c\uad6c\uc808\uc808\ud55c \ubb38\ubc95\uc744 \uc124\uba85\ud558\ub294 \ub300\uc2e0 Utility Type \uc911 ReturnType\uc758 \uad6c\ud604 \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uace0\uc790 \ud569\ub2c8\ub2e4. ReturnType\uc740 \uc785\ub825\ub41c \ud568\uc218 \ud0c0\uc785\uc758 \ubc18\ud658 \ud0c0\uc785\uc744 \uc5bb\ub294 TypeScript\uc5d0 \uc774\ubbf8 \uc815\uc758\ub41c API\uc785\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc774 ReturnType\uc740 \ub124\uc774\ud2f0\ube0c\uac00 \uc544\ub2cc TypeScript \uc5b8\uc5b4\ub85c \uc791\uc131\ub41c \ub140\uc11d\uc785\ub2c8\ub2e4. \uc774\ub54c \uc870\uac74\ubd80 \ud0c0\uc785(Conditional Type) \ubb38\ubc95\uc774 \uc0ac\uc6a9\ub418\ub294\ub370\uc694. ReturnType\uc744 \ube44\ub86f\ud55c \ub300\ub2e4\uc218\uc758 Utility Type \ub4e4\uc740 \uc870\uac74\ubd80 \ud0c0\uc785 \ubb38\ubc95\uc744 \ud1b5\ud574 \uad6c\ud604\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. ReturnType\uc758 \uad6c\ud604 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=16949\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;TypeScript Utility Type\uc758 \uae30\ubc18, \uc870\uac74\ubd80 \ud0c0\uc785(Conditional Type)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[],"class_list":["post-16949","post","type-post","status-publish","format-standard","hentry","category-typescript"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16949","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16949"}],"version-history":[{"count":6,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16949\/revisions"}],"predecessor-version":[{"id":16955,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16949\/revisions\/16955"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16949"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}