(type of var fromStructures is AnyStoreStructure[])
Argument in the filter function in the option of findClosestByRange has an implicit any type
While in findClosestByPath, this argument is typed correctly
Sample code (if available)
let fromStructures = [] as AnyStoreStructure[]
let creep = {} as Creep
{
let target = creep.pos.findClosestByPath(fromStructures, {
//OK `s` here is inferred as `AnyStoreStructure`
filter: (s) => {
return s.structureType === STRUCTURE_CONTAINER;
}
});
}
{
let target = creep.pos.findClosestByRange(fromStructures, {
//!Error `s` here has an implicit `any` type
filter: (s) => {
return s.structureType === STRUCTURE_CONTAINER;
}
});
}
Bug description
(type of var
fromStructures
isAnyStoreStructure[]
)Argument in the filter function in the option of
findClosestByRange
has an implicit any typeWhile in
findClosestByPath
, this argument is typed correctlySample code (if available)
Your Environment
@types/screeps
version: 3.3.0