demo/typescript.js
function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) {
            var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true);
            forEachMatchingParameterType(contextualSignature, signature, function (source, target) {
                // Type parameters from outer context referenced by source type are fixed by instantiation of the source type
                inferTypes(context, instantiateType(source, contextualMapper), target);
            });
            return getSignatureInstantiation(signature, getInferredTypes(context));
        }
function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) {
            var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true);
            forEachMatchingParameterType(contextualSignature, signature, function (source, target) {
                // Type parameters from outer context referenced by source type are fixed by instantiation of the source type
                inferTypes(context, instantiateType(source, contextualMapper), target);
            });
            return getSignatureInstantiation(signature, getInferredTypes(context));
        }
function instantiateSignatureInContextOf ( signature , contextualSignature , contextualMapper ) { var context = createInferenceContext ( signature . typeParameters , /*inferUnionTypes*/ true ) ; forEachMatchingParameterType ( contextualSignature , signature , function ( source , target ) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type inferTypes ( context , instantiateType ( source , contextualMapper ) , target ) ; } ) ; return getSignatureInstantiation ( signature , getInferredTypes ( context ) ) ; }
Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec)
Instantiate a generic signature in the context of a non - generic signature ( section 3 . 8 . 5 in TypeScript spec )