@turf/line-slice-along to TypeScript#2978
Conversation
| path.join(__dirname, "test", "fixtures", "route2.geojson") | ||
| ); | ||
|
|
||
| const options = { units: "miles" } as const; |
There was a problem hiding this comment.
I think this had been broken when we changed the options to an object
There was a problem hiding this comment.
Huh. So why wasn't the isObject call catching this? Or was bench just not being run by anyone?
There was a problem hiding this comment.
Yeah I think it was just broken. There's no actual testing making sure bench works. I don't think we really want to just burn CI time benchmarking though.
| path.join(__dirname, "test", "fixtures", "route2.geojson") | ||
| ); | ||
|
|
||
| const options = { units: "miles" } as const; |
There was a problem hiding this comment.
Huh. So why wasn't the isObject call catching this? Or was bench just not being run by anyone?
| ): Feature<LineString> { | ||
| // Optional parameters | ||
| options = options || {}; | ||
| if (!isObject(options)) throw new Error("options is invalid"); |
There was a problem hiding this comment.
Reckon we should set default units explicitly even if it effectively happens a lower level. Maybe we destructure similar to #2974?
const { units = "kilometers" } = options;
That'd also make sure we're not passing any rando options further down to distance or destination.
There was a problem hiding this comment.
Good point about accidentally sending extra options down.
|
|
||
| var coords; | ||
| var slice = []; | ||
| var coords: Position[]; |
There was a problem hiding this comment.
Another couple of vars we could jettison.
There was a problem hiding this comment.
Lets just apply eslint's no-var and prefer-const (in another PR)
No description provided.