개념
함수의 파라마터의 Type을 Type으로 사용하고 싶을 때
function f1(arg: {a:number; b:string}) {
}
type T1 = Parameters<typeof f1>
/**
*
* [arg: { a:number; b:string }]
*
*/
type T2 = Parameters<typeof f1>[0]
/**
*
* { a:number; b:string }
*
*/
https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype
Documentation - Utility Types
Types which are globally included in TypeScript
www.typescriptlang.org
'IT > typescript' 카테고리의 다른 글
[Typescript] Complier Options - suppressImplicitAnyIndexErrors (0) | 2024.03.12 |
---|---|
[typescript] ConstructorParameters<Type> (0) | 2024.03.11 |
[Typescript] Type-Only Imports and Export (0) | 2024.03.08 |
[Typescript] satisfies (0) | 2024.02.22 |
[Typescript] 타입 호환성 (0) | 2024.02.22 |