Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

allow functions as first argument to Object.assign #3098

Merged
merged 2 commits into from Aug 6, 2017
Merged

allow functions as first argument to Object.assign #3098

merged 2 commits into from Aug 6, 2017

Conversation

davidgoli
Copy link
Contributor

@davidgoli davidgoli commented Aug 4, 2017

PR checklist

Overview of change:

Permits functions as first argument to Object.assign

Is there anything you'd like reviewers to focus on?

CHANGELOG.md entry:

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @davidgoli! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@@ -51,6 +51,7 @@ function walk(ctx: Lint.WalkContext<void>) {
isPropertyAccessExpression(node.expression) && node.expression.name.text === "assign" &&
isIdentifier(node.expression.expression) && node.expression.expression.text === "Object" &&
// Object.assign(...someArray) cannot be written as object spread
!ts.isFunctionLike(node.arguments[0]) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this line above the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ajafff ajafff merged commit d7fab55 into palantir:master Aug 6, 2017
@ajafff
Copy link
Contributor

ajafff commented Aug 6, 2017

Thanks @davidgoli

@wesleymostien
Copy link

wesleymostien commented Oct 24, 2017

only works for anonymous functions ?

Doesn't complain here :

export default Object.assign((args) => {
  cons.log(args);
}, log);

But does complain here :

function jos (args) {
  cons.log(args);
}
export default Object.assign(jos, log);

Is this a bug or by design ?

HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 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.

None yet

4 participants