Skip to content

Commit d55121a

Browse files
authored
Merge pull request #179 from klzns/relax-type
Make cache type less strict
2 parents b4cf7eb + 5c17961 commit d55121a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/find.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Pbf from 'pbf'
77

88
import { getTimezoneAtSea, oceanZones } from './oceanUtils'
99

10+
type MapLike = {
11+
get(key: string): any
12+
set(key: string, value: any): void
13+
}
14+
1015
export type CacheOptions = {
1116
/**
1217
* If set to true, all features will be loaded into memory to shorten future lookup
@@ -16,7 +21,7 @@ export type CacheOptions = {
1621
/**
1722
* Must be a map-like object with a `get` and `set` function.
1823
*/
19-
store?: Map<string, any>
24+
store?: MapLike
2025
}
2126

2227
/**
@@ -69,7 +74,7 @@ function _preCache(
6974
tzData: any,
7075
featureFilePath: string,
7176
featureFileFd: number,
72-
featureCache: Map<string, any>,
77+
featureCache: MapLike,
7378
) {
7479
// shoutout to github user @magwo for an initial version of this recursive function
7580
function preloadFeaturesRecursive(curTzData, quadPos: string) {
@@ -147,7 +152,7 @@ function loadFeatures(
147152
*/
148153
export function findUsingDataset(
149154
tzData: any,
150-
featureCache: any,
155+
featureCache: MapLike,
151156
featureFilePath: string,
152157
lat: number,
153158
lon: number,

0 commit comments

Comments
 (0)