support generic variant setter (#55030)

This commit is contained in:
Zzzen
2023-08-29 14:11:33 -07:00
committed by GitHub
parent 23c9752367
commit c5f92d4150
5 changed files with 174 additions and 3 deletions
+9 -3
View File
@@ -19098,10 +19098,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol {
const links = getSymbolLinks(symbol);
// If the type of the symbol is already resolved, and if that type could not possibly
// be affected by instantiation, simply return the symbol itself.
if (links.type && !couldContainTypeVariables(links.type)) {
// If the type of the symbol is already resolved, and if that type could not possibly
// be affected by instantiation, simply return the symbol itself.
return symbol;
if (!(symbol.flags & SymbolFlags.SetAccessor)) {
return symbol;
}
// If we're a setter, check writeType.
if (links.writeType && !couldContainTypeVariables(links.writeType)) {
return symbol;
}
}
if (getCheckFlags(symbol) & CheckFlags.Instantiated) {
// If symbol being instantiated is itself a instantiation, fetch the original target and combine the