{"id":16922,"date":"2026-07-16T14:39:46","date_gmt":"2026-07-16T05:39:46","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=16922"},"modified":"2026-07-16T15:26:42","modified_gmt":"2026-07-16T06:26:42","slug":"%ec%86%8d%ec%84%b1%ec%9d%84-%ea%b0%80%ec%a7%80%eb%8a%94-%ed%95%a8%ec%88%98-%ed%83%80%ec%9e%85-%ec%a0%95%ec%9d%98","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=16922","title":{"rendered":"TypeScript\uc5d0\uc11c \ud568\uc218\uc5d0 \ub300\ud55c \uc2dc\uadf8\ub2c8\uccd0"},"content":{"rendered":"<p>\uc18d\uc131\uc744 \uac70\uc9c0\ub294 \ud568\uc218 \ud0c0\uc785 \uc815\uc758 (\uc815\ud655\ud788\ub294 \ud638\ucd9c \uc2dc\uadf8\ub2c8\ucc98(call signature))<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\ntype FunctionWithProperties = {\r\n  (someArg: number): boolean;\r\n\r\n  description: string;\r\n};\r\n\r\nfunction doSomething(fn: FunctionWithProperties) {\r\n  console.log(fn.description + \": \uacb0\uacfc = \" + fn(6));\r\n}\r\n\r\n\/\/ \ud568\uc218 \uc0dd\uc131\r\nconst isGreaterThanFive: FunctionWithProperties = (num: number) => {\r\n  return num > 5;\r\n};\r\n\r\n\/\/ \uc18d\uc131 \ucd94\uac00\r\nisGreaterThanFive.description = \"5\ubcf4\ub2e4 \ud070\uc9c0 \ud655\uc778\ud558\ub294 \ud568\uc218\";\r\n\r\n\r\n\/\/ \ud568\uc218 \ud638\ucd9c\r\ndoSomething(isGreaterThanFive);\r\n<\/pre>\n<p>\ud074\ub798\uc2a4\uc758 \uc0dd\uc131\uc790\uc5d0 \ub300\ud55c \ud568\uc218 \ud0c0\uc785 \uc815\uc758 (\uc815\ud655\ud788\ub294 \uc0dd\uc131\uc790 \uc2dc\uadf8\ub2c8\ucc98(construct signature))<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\ntype SomeConstructor = {\r\n  new (s: string): MyClass;\r\n};\r\n\r\nfunction fn(ctor: SomeConstructor) {\r\n  return new ctor(\"hello\");\r\n}\r\n\r\nclass MyClass {\r\n  field: string = \"hello\";\r\n\r\n  constructor(message: string) {\r\n    console.log(\"constructor called:\", message);\r\n  }\r\n}\r\n\r\nconst a = fn(MyClass);\r\nconsole.log(a.field);\r\n<\/pre>\n<p>\uc704\uc758 2\uac00\uc9c0 \uc694\uc18c\ub97c \uc870\ud569\ud574 \ubcf4\uba74&#8230;.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"typescript\">\r\ninterface CallOrConstruct {\r\n  new (s: string): Date;\r\n  (n?: number): number;\r\n}\r\n\r\n\/\/ \ud568\uc218 \uac1d\uccb4 \uc0dd\uc131\r\nconst callOrConstruct: CallOrConstruct = function (n?: number): number {\r\n  return n ?? 0;\r\n} as CallOrConstruct;\r\n\r\n\/\/ \uc0dd\uc131\uc790 \ub3d9\uc791 \ucd94\uac00\r\ncallOrConstruct.prototype = Date.prototype;\r\n\r\n\/\/ \uc77c\ubc18 \ud568\uc218\ucc98\ub7fc \ud638\ucd9c\r\nconst result = callOrConstruct(100);\r\n\r\nconsole.log(result); \/\/ 100\r\n\r\n\/\/ \uc0dd\uc131\uc790\ucc98\ub7fc \ud638\ucd9c\r\nconst date = new callOrConstruct(\"2026-07-16\");\r\n\r\nconsole.log(date);\r\nconsole.log(date instanceof Date);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uc18d\uc131\uc744 \uac70\uc9c0\ub294 \ud568\uc218 \ud0c0\uc785 \uc815\uc758 (\uc815\ud655\ud788\ub294 \ud638\ucd9c \uc2dc\uadf8\ub2c8\ucc98(call signature)) type FunctionWithProperties = { (someArg: number): boolean; description: string; }; function doSomething(fn: FunctionWithProperties) { console.log(fn.description + &#8220;: \uacb0\uacfc = &#8221; + fn(6)); } \/\/ \ud568\uc218 \uc0dd\uc131 const isGreaterThanFive: FunctionWithProperties = (num: number) => { return num > 5; }; \/\/ \uc18d\uc131 \ucd94\uac00 isGreaterThanFive.description = &#8220;5\ubcf4\ub2e4 \ud070\uc9c0 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=16922\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;TypeScript\uc5d0\uc11c \ud568\uc218\uc5d0 \ub300\ud55c \uc2dc\uadf8\ub2c8\uccd0&#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":[88],"tags":[],"class_list":["post-16922","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16922","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=16922"}],"version-history":[{"count":5,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16922\/revisions"}],"predecessor-version":[{"id":16925,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/16922\/revisions\/16925"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16922"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}