You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
Result: ERROR: /Users/David/dev/hello-epics/power-up/src/app/cache.ts[12, 10]: 'Object.assign' returns the first argument. Prefer object spread if you want a new object.
With prettier fix:
{...()=>{},foo(){},}
Expected behavior
prefer-object-spread should prefer Object.assign when the first argument is a function, as object rest spread on a function is somewhat nonsensical & probably not desired behavior.
The text was updated successfully, but these errors were encountered:
I don't know if we want to add special handling for functions (and classes and everything that has a call or contruct signature ...)
For the time being you can use the following workaround:
The special handling could all be syntactic (done without the type checker), right? You'd just need to check for function expressions and class expressions as the first argument. I think we could take a PR for this.
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
Result:
ERROR: /Users/David/dev/hello-epics/power-up/src/app/cache.ts[12, 10]: 'Object.assign' returns the first argument. Prefer object spread if you want a new object.
With prettier fix:
Expected behavior
prefer-object-spread should prefer
Object.assign
when the first argument is a function, as object rest spread on a function is somewhat nonsensical & probably not desired behavior.The text was updated successfully, but these errors were encountered: