Skip to content

Comments

Allow use of "arguments" on ambient context#15490

Merged
mhegazy merged 2 commits intomicrosoft:masterfrom
saschanaz:allowArguments
May 4, 2017
Merged

Allow use of "arguments" on ambient context#15490
mhegazy merged 2 commits intomicrosoft:masterfrom
saschanaz:allowArguments

Conversation

@saschanaz
Copy link
Contributor

Fixes #15390

return false;
}

if (isDeclarationFile(file) || isInAmbientContext(node)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does isInAmbientContext cover the above cases?

Copy link
Contributor Author

@saschanaz saschanaz May 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I hope so but it only checks whether parent nodes have declare modifiers. I first tried modifying it but it broke other tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

}

function needParameterStrictModeCheck(node: Node) {
if (node.parent.kind === SyntaxKind.ConstructorType || node.parent.kind === SyntaxKind.FunctionType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think why not, but I agree this is not strictly necessary. Done!

return false;
}

if (isDeclarationFile(file) || isInAmbientContext(node)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@saschanaz
Copy link
Contributor Author

Requested change is done, is there any more requirement?

@mhegazy mhegazy merged commit d9b459b into microsoft:master May 4, 2017
@saschanaz saschanaz deleted the allowArguments branch May 4, 2017 19:58
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants