Consistently resolve to the errorType on arguments with error (#62549)

This commit is contained in:
Mateusz Burzyński
2025-10-05 15:40:28 -07:00
committed by GitHub
parent d0d675a363
commit 6ba7d3560f
2 changed files with 33 additions and 33 deletions
+1 -1
View File
@@ -30975,7 +30975,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
checkIdentifierCalculateNodeCheckFlags(node, symbol);
if (symbol === argumentsSymbol) {
if (isInPropertyInitializerOrClassStaticBlock(node)) {
if (isInPropertyInitializerOrClassStaticBlock(node, /*ignoreArrowFunctions*/ true)) {
return errorType;
}
return getTypeOfSymbol(symbol);
@@ -116,12 +116,12 @@ function D() {
> : ^^^^^^^^
a = () => arguments // should error
>a : () => IArguments
> : ^^^^^^^^^^^^^^^^
>() => arguments : () => IArguments
> : ^^^^^^^^^^^^^^^^
>arguments : IArguments
> : ^^^^^^^^^^
>a : () => any
> : ^^^^^^^^^
>() => arguments : () => any
> : ^^^^^^^^^
>arguments : any
> : ^^^
}
}
@@ -142,18 +142,18 @@ function D1() {
> : ^^^^^^^^^^
arguments; // should error
>arguments : IArguments
> : ^^^^^^^^^^
>arguments : any
> : ^^^
const b = () => {
>b : () => IArguments
> : ^^^^^^^^^^^^^^^^
>() => { return arguments; // should error } : () => IArguments
> : ^^^^^^^^^^^^^^^^
>b : () => any
> : ^^^^^^^^^
>() => { return arguments; // should error } : () => any
> : ^^^^^^^^^
return arguments; // should error
>arguments : IArguments
> : ^^^^^^^^^^
>arguments : any
> : ^^^
}
function f() {
@@ -286,16 +286,16 @@ function D5() {
> : ^^^^^^^^
a = (() => { return arguments; })() // should error
>a : IArguments
> : ^^^^^^^^^^
>(() => { return arguments; })() : IArguments
> : ^^^^^^^^^^
>(() => { return arguments; }) : () => IArguments
> : ^^^^^^^^^^^^^^^^
>() => { return arguments; } : () => IArguments
> : ^^^^^^^^^^^^^^^^
>arguments : IArguments
> : ^^^^^^^^^^
>a : any
> : ^^^
>(() => { return arguments; })() : any
> : ^^^
>(() => { return arguments; }) : () => any
> : ^^^^^^^^^
>() => { return arguments; } : () => any
> : ^^^^^^^^^
>arguments : any
> : ^^^
}
}
@@ -310,14 +310,14 @@ function D6() {
> : ^^^^^^^^
a = (x = arguments) => {} // should error
>a : (x?: IArguments) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^
>(x = arguments) => {} : (x?: IArguments) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^
>x : IArguments
> : ^^^^^^^^^^
>arguments : IArguments
> : ^^^^^^^^^^
>a : (x?: any) => void
> : ^ ^^^^^^^^^^^^^^^
>(x = arguments) => {} : (x?: any) => void
> : ^ ^^^^^^^^^^^^^^^
>x : any
> : ^^^
>arguments : any
> : ^^^
}
}