feat(typecheck): Assert를 tuple-wrap AssertCompat+Expect로 강화 — 시그니처 호환성 진짜 검증#594
Merged
Conversation
…성 진짜 검증 (#592) `Assert<TMock, TOriginal> = TMock extends TOriginal ? true : never` 패턴은 불일치 시 `type _X = never`를 허용해 시그니처 미스매치를 무음으로 통과시켰다. - `AssertCompat<TMock, TOriginal> = [TMock] extends [TOriginal] ? true : false` tuple-wrap으로 distributive 단락 방지 + false 반환 - `Expect<T extends true>` 래퍼로 false → TS2344 컴파일 에러 강제 - `AssertIfPresent<TMockNS, TOrigNS, K>` SDK 라인별 capability-gate - `__typecheck.ts`/`__typecheck-2x.ts` 전체 마이그레이션 강화 과정에서 발견된 실제 미스매치 수정: - permissions: `getPermission`/`openPermissionDialog`/`requestPermission` 파라미터가 `PermissionName` 단독이 아닌 `{ name, access }` 객체임 - navigation: `graniteEvent`/`tdsEvent` SDK `GraniteEvent`/`TdsEvent` 직접 사용 (로컬 타입 미러 제거) - game: `contactsViral` `onEvent` 타입을 SDK `ContactsViralEvent` 직접 사용 - analytics: `eventLog` `log_type` 좁은 유니온 → SDK 정의 `string`으로 - ads: `showAppsInTossAdMob` 이벤트 시퀀스 및 `loadFullScreenAd`/`showFullScreenAd` options 필드 정합 - auth: `getUserKeyForGame` SDK 3.0에서 sentinel 제거 → 항상 `{ hash, type }` 객체 - 2x 라인: `loadAppsInTossAdMob`/`showAppsInTossAdMob` 4개 assertion skip (2.x options optional+onError:Error vs 3.0 options required+onError:unknown 는 의도된 breaking change) 네거티브 테스트: `isMinVersionSupported` 반환 타입을 `string`으로 변경 시 `__typecheck.ts(63)` TS2344 발생 확인 후 복원.
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.
목적
Assert<TMock, TOriginal> = TMock extends TOriginal ? true : never패턴이 불일치 시type _X = never를 조용히 허용하는 구조적 허점(#592)을 수정한다.변경 내용
핵심 유틸 (
src/__typecheck-shared.ts)AssertCompat<TMock, TOriginal>— tuple-wrap[TMock] extends [TOriginal] ? true : false로 distributive 단락 방지 + false 반환Expect<T extends true>—T가false이면 TS2344 컴파일 에러 강제AssertIfPresent<TMockNS, TOrigNS, K>— SDK 라인별 capability-gate (심볼이 해당 SDK 버전에 없으면 skip)타입체크 마이그레이션
__typecheck.ts/__typecheck-2x.ts전체의type _X = Assert<A, B>→type _X = Expect<AssertCompat<A, B>>강화로 발견·수정된 실제 미스매치
getPermission등 파라미터PermissionName단독이 아닌{ name, access }객체graniteEvent/tdsEvent로컬 타입 미러가 SDK 타입과 미묘하게 달랐음GraniteEvent/TdsEvent직접 사용contactsViralonEvent타입 너무 넓음ContactsViralEvent직접 사용eventLoglog_type좁은 유니온string으로showAppsInTossAdMob이벤트 시퀀스, FullScreenAd options 정합getUserKeyForGameSDK 3.0에서 sentinel 제거{ hash, type }객체 반환2x 라인 skip (의도된 breaking change)
loadAppsInTossAdMob/showAppsInTossAdMob/FullScreenAd 4개 assertion은 2x SDK의options?optional +onError: Errorvs 3.0의optionsrequired +onError: unknown차이로 skip 처리 (주석으로 이유 명시).네거티브 테스트
isMinVersionSupported반환 타입을string으로 변경 시__typecheck.ts(63)TS2344 발생 확인 후 복원. 새 타입 가드가 실제로 동작함을 검증.검증
pnpm typecheck— 4개 tsc invocation 모두 통과pnpm lint— 에러 없음 (info 32개만)pnpm test— 92 파일, 1844 테스트 통과Closes #592