일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- javascript
- typescript
- TCP
- 크롤링
- 수학
- Algorithm
- BFS
- dp
- 소켓
- HTTP 완벽 가이드
- 그래프
- Nestjs
- 레벨 1
- 타입스크립트
- ip
- 문자열
- type challenge
- 알고리즘
- 쉬운 문제
- socket
- 타입 챌린지
- dfs
- 백준
- Node.js
- 프로그래머스 레벨 2
- Crawling
- 자바스크립트
- 프로그래머스
- HTTP
- 가천대
- Today
- Total
목록type level (5)
kakasoo
https://kscodebase.tistory.com/682 타입 레벨에서 문자열 Join 구현하기 type ToString= T extends string ? T : never; type ToStringTuple= T extends string[] ? T : never; type Join = T extends [infer F, ...infer Rest] ? `${ToString}${Join}` : ''; 문자열로 이루어진 배열을 받아 Join하는 타입을 구현했다. type kscodebase.tistory.com Join의 다른 구현 방법 type Join = Target extends [infer..
타입스크립트 언어는 자바스크립트와 타입 레벨을 합친 언어다. 따라서 타입을 지정하는 것 뿐만 아니라 직접 타입을 구현할 수 있는 수준이 되어야 타입스크립트 쓰는 것이다. 하지만 타입 레벨에서는 언어에서 지원하는 사칙연산이 존재하지 않기 때문에 여기서부터 난이도가 급상승한다. 따라서 수학 공식에서 사용할 수 있는 타입들을 미리 구현하고 달달 외우면 반대로 난이도를 하락시킬 수 있다. 아래는 모두 내가 사용하고자 만든, 수학 법칙처럼 사용할 수 있는 유틸리티성 타입들이다. Length type Length = T['length']; type answer0 = Length; // 0 type answer1 = Length; // 1 type answer2 = Length; // 2 type answer3 = ..
타입 챌린지의 문제인데, 미디움에 있었다. 끔찍한 수준의 난이도인데 이게 왜 medium인지 모르겠다. 아래에 문제를 이해하기 위해 필요한 지식과 해석 순서를 모두 기재하였으니 참고하도록 하자. 문제, 그리고 필요로 하는 결과 type cases = [ Expect, Expect, Expect, Expect, Expect, ] 분산적 조건 타입 type Singular = T extends never ? true : false; type IfAnySingular = Singular; // boolean 타입스크립트 핸드북 - 분산적 조건 타입 Documentation - Conditional Types Create types which act like if statements in the type sys..
GitHub - type-challenges/type-challenges: Collection of TypeScript type challenges with online judge Collection of TypeScript type challenges with online judge - GitHub - type-challenges/type-challenges: Collection of TypeScript type challenges with online judge github.com type MyReturnType = T extends (...args:any[]) => infer R ? R : never; 어떤 타입 T를 정의할 때, 그 T에 대한 정의는 반드시 제너릭 쪽에 되어야 할 필요가 없다. 제..
[Feature request]type level equal operator · Issue #27024 · microsoft/TypeScript Search Terms Type System Equal Suggestion T1 == T2 Use Cases TypeScript type system is highly functional. Type level testing is required. However, we can not easily check type equivalence. I want a... github.com 글에서 Equals을 어떻게 설명하는지 나와있다. 다만, 완벽한 정의가 아니고, 대부분의 상황에 적합한 것이기 때문에 유틸리티 타입에 포함되지는 않는 것 같다. export type Equ..