post(blog): TypeScript 조건부 타입과 infer 포스트 추가 (#36) - #137
Merged
Conversation
- ReturnType·Parameters·Awaited를 infer로 직접 구현하며 조건부 타입 원리 설명 - 분배 조건부 타입과 never 증발, [T] extends [U]로 분배 끄기까지 정리 - 모든 예제를 tsc(strict) 컴파일 + 타입 동등성 단언으로 검증
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- '무는 함정'→'빠지는 함정', '~때' 중복 제거로 문장 다듬기 - frontmatter description의 백틱 제거(검색 프리뷰·SEO 스니펫에 리터럴 노출 방지) - 표준 Awaited 방주를 thenable에서 값을 꺼내 재귀하는 흐름으로 정확히 서술
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
#36 이슈의 주제로, 조건부 타입과
infer를 분해하고 내장 유틸리티 타입을 직접 구현해 보는 포스트를 추가했습니다.apps/blog/src/app/(main)/posts/frontend/ts-conditional-types/page.mdxfrontend/ postId:ts-conditional-types다루는 내용
T extends U ? X : Y— 타입 세계의 삼항 연산자,extends는 상속이 아니라 할당 가능성(subtype) 판정extends패턴에 구멍을 뚫어 타입을 꺼내는 원리 (정규식 캡처 그룹 비유)ReturnType(반환 위치) /Parameters(인자 위치) /Awaited(재귀로 중첩 Promise 평탄화)never증발 함정,[T] extends [U]로 분배 끄기,Exclude·Extract직접 구현검증
Equal/Expect타입 동등성 단언으로 증명 (내장 유틸리티와 결과 일치 포함)pnpm run build통과 (정적 페이지 생성 확인)pnpm run lint통과 (--max-warnings 0)postId가 폴더명과 일치, 기존 TS 시리즈(ts-generics·ts-never-unknown·ts-type-narrowing) 상호 참조 연결Closes #36