screepers / typed-screeps

Strong TypeScript declarations for the game Screeps.
MIT License
189 stars 77 forks source link

Add type inference for params in filter callbacks #221

Closed DiamondMofeng closed 1 year ago

DiamondMofeng commented 1 year ago

Brief Description

See #219.

RoomPosition.findInRange or findclosestByRange can not infer the type of params in filter callback function when the first arg is targets[] instead of a FindConstant.

We should fix this, because in typescript strict mode, implict any type for function params is forbidden.


Besides, RoomPosition.findInRange or findclosestByRange with first arg as targets[] also do not support filter callback's type predicate.

I will fix it after this PR is merged.

Checklists