Open kscory opened 5 months ago
type Absolute<T extends number | string | bigint> = `${T}` extends `-${infer U}` ? U : `${T}`;
type Absolute<T extends number | string | bigint> = `${T}` extends `${infer F}${infer REST}` ?
F extends Out ? `${Absolute<REST>}` : `${F}${Absolute<REST>}` : ""
저두요 템플릿러터럴로 형변환해줘야 되더라구요...
- extends 전에 template literal로 형변환 처음알았습니다,,
type Absolute<T extends number | string | bigint> = `${T}` extends `-${infer U}` ? U : `${T}`;
와우 간단하네요
type Absolute<T extends number | string | bigint> = `${T}` extends `-${infer N}` ? N : `${T}`
답안을 작성해주세요.