Allow use of "arguments" on ambient context#15490
Conversation
src/compiler/binder.ts
Outdated
| return false; | ||
| } | ||
|
|
||
| if (isDeclarationFile(file) || isInAmbientContext(node)) { |
There was a problem hiding this comment.
Does isInAmbientContext cover the above cases?
There was a problem hiding this comment.
No, I hope so but it only checks whether parent nodes have declare modifiers. I first tried modifying it but it broke other tests.
There was a problem hiding this comment.
isInAmbientContext actually checks the parent file at the end.
Also do not use file directly, you do not know what file you are checking, and what it cases the checker to jump into. no guarantees that the checker proceeds to check all nodes in a file before jumping to another.
src/compiler/binder.ts
Outdated
| } | ||
|
|
||
| function needParameterStrictModeCheck(node: Node) { | ||
| if (node.parent.kind === SyntaxKind.ConstructorType || node.parent.kind === SyntaxKind.FunctionType) { |
There was a problem hiding this comment.
i do not think this is important. i would say if this is your code, and this is a .ts file and your writing an interface with arguments, change it.
the issue is more of a problem with .d.ts files, so i would just use isInAmbientContext.
There was a problem hiding this comment.
I think why not, but I agree this is not strictly necessary. Done!
src/compiler/binder.ts
Outdated
| return false; | ||
| } | ||
|
|
||
| if (isDeclarationFile(file) || isInAmbientContext(node)) { |
There was a problem hiding this comment.
isInAmbientContext actually checks the parent file at the end.
Also do not use file directly, you do not know what file you are checking, and what it cases the checker to jump into. no guarantees that the checker proceeds to check all nodes in a file before jumping to another.
|
Requested change is done, is there any more requirement? |
Fixes #15390