https://github.com/microsoft/TypeScript/pull/61872
https://github.com/typescript-eslint/typescript-eslint/pull/10744 여기서 타입스크립트 코드를 읽은것을 바탕으로 고칠 수 있는 이슈가 있나해서 찾아봤다.
내가 수정한 코드가 구현된 몇년전 pr 도 찾아볼 수 있었다.
깃관리 중요성을 깨달은 pr이었다.
언젠가는 merge 될 수도 있지 않을까 기대해본다.
export type QueryFunction<
T = unknown,
> = () => Promise<T> | T
type InferTest<T> = T extends QueryFunction ? string:never
type T2 = InferTest<()=>Promise<3>>
//getConditionalType
if (inferredExtendsType.flags & TypeFlags.AnyOrUnknown || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
console.log('is true type')
const trueType = getTypeFromTypeNode(root.node.trueType);
const trueMapper = combinedMapper || mapper;
if (canTailRecurse(trueType, trueMapper)) {
continue;
}
result = instantiateType(trueType, trueMapper);
break;
}
inferTypes
는 context 의 inferences 를 변형시킴
실제로 inferences 의 inferredType은 makeFixingMapperForContext⇒ getInferredType ⇒ getTypeFromInference 의 candidate