-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
InfrastructureIssue relates to TypeScript team infrastructureIssue relates to TypeScript team infrastructure
Description
public verifyRangesAreRenameLocations(options?: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges?: Range[] }) {
const ranges = ts.isArray(options) ? options : options && options.ranges || this.getRanges();
this.verifyRenameLocations(ranges, { ranges, ...options });
}
When options
is a Range[]
, the object spread creates an object that is like an array, except without its methods, and with a property named ranges
that is the array itself. This works fine because of the way that verifyRenameLocations
uses ts.isArray
(the spread object never is), but should probably be something more like:
const ranges = ts.isArray(options) ? options : options.ranges || this.getRanges();
this.verifyRenameLocations(ranges, ts.isArray(options) ? options : { ranges, ...options });
Found while working on excess property checks, although this usage is not actually an error in the PR.
Metadata
Metadata
Assignees
Labels
InfrastructureIssue relates to TypeScript team infrastructureIssue relates to TypeScript team infrastructure