mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fixed display of optional and rest parameters created as result of combining union parameters (#55625)
This commit is contained in:
@@ -13202,12 +13202,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const paramSymbol = createSymbol(
|
||||
SymbolFlags.FunctionScopedVariable | (isOptional && !isRestParam ? SymbolFlags.Optional : 0),
|
||||
paramName || `arg${i}` as __String,
|
||||
isRestParam ? CheckFlags.RestParameter : isOptional ? CheckFlags.OptionalParameter : 0,
|
||||
);
|
||||
paramSymbol.links.type = isRestParam ? createArrayType(unionParamType) : unionParamType;
|
||||
params[i] = paramSymbol;
|
||||
}
|
||||
if (needsExtraRestElement) {
|
||||
const restParamSymbol = createSymbol(SymbolFlags.FunctionScopedVariable, "args" as __String);
|
||||
const restParamSymbol = createSymbol(SymbolFlags.FunctionScopedVariable, "args" as __String, CheckFlags.RestParameter);
|
||||
restParamSymbol.links.type = createArrayType(getTypeAtPosition(shorter, longestCount));
|
||||
if (shorter === right) {
|
||||
restParamSymbol.links.type = instantiateType(restParamSymbol.links.type, mapper);
|
||||
|
||||
Reference in New Issue
Block a user