사용자 도구

사이트 도구


typescript:function

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
typescript:function [2019/07/28 05:11] – [Overloads] taekgutypescript:function [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1
줄 67: 줄 67:
 let myAdd = function(x: number, y: number): number { return x + y; }; let myAdd = function(x: number, y: number): number { return x + y; };
  
-// The parameters 'x' and 'y' have the type numbe+// The parameters 'x' and 'y' have the type number
 let myAdd: (baseValue: number, increment: number) => number = let myAdd: (baseValue: number, increment: number) => number =
     function(x, y) { return x + y; };     function(x, y) { return x + y; };
줄 340: 줄 340:
 } }
 </code> </code>
 +
 +함수명과 매개변수의 개수는 같지만 타입을 다른 경우.
 +다른 언어의 오버로드는 함수명만 동일하면 되지만 TypeScript의 오버로딩은 함수명과 매개변수의 갯수가 같아야 한다.
typescript/function.1564290703.txt.gz · 마지막으로 수정됨: 2025/04/15 10:05 (바깥 편집)