mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Component commits:e77514a53bAdd failing test.3c0d51b3edCheck for type parameters on the original type when asking for the type argument constraint.e7c8095935Update tests/cases/fourslash/stringLiteralTypeCompletionsInTypeArgForNonGeneric1.ts Co-authored-by: Daniel Rosenwasser <drosen@microsoft.com>
This commit is contained in:
co-authored by
Daniel Rosenwasser
parent
e4a2494065
commit
0651bd3ada
@@ -34730,7 +34730,8 @@ namespace ts {
|
||||
function getTypeArgumentConstraint(node: TypeNode): Type | undefined {
|
||||
const typeReferenceNode = tryCast(node.parent, isTypeReferenceType);
|
||||
if (!typeReferenceNode) return undefined;
|
||||
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode)!; // TODO: GH#18217
|
||||
const typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
|
||||
if (!typeParameters) return undefined;
|
||||
const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments!.indexOf(node)]);
|
||||
return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="./fourslash.ts" />
|
||||
|
||||
////interface Foo {}
|
||||
////type Bar = {};
|
||||
////
|
||||
////let x: Foo<"/*1*/">;
|
||||
////let y: Bar<"/*2*/">;
|
||||
|
||||
verify.completions({ marker: test.markers() });
|
||||
|
||||
Reference in New Issue
Block a user