Skip to content

Commit

Permalink
Merge pull request #179 from klzns/relax-type
Browse files Browse the repository at this point in the history
Make cache type less strict
  • Loading branch information
evansiroky authored Oct 8, 2024
2 parents b4cf7eb + 5c17961 commit d55121a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import Pbf from 'pbf'

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

type MapLike = {
get(key: string): any
set(key: string, value: any): void
}

export type CacheOptions = {
/**
* If set to true, all features will be loaded into memory to shorten future lookup
Expand All @@ -16,7 +21,7 @@ export type CacheOptions = {
/**
* Must be a map-like object with a `get` and `set` function.
*/
store?: Map<string, any>
store?: MapLike
}

/**
Expand Down Expand Up @@ -69,7 +74,7 @@ function _preCache(
tzData: any,
featureFilePath: string,
featureFileFd: number,
featureCache: Map<string, any>,
featureCache: MapLike,
) {
// shoutout to github user @magwo for an initial version of this recursive function
function preloadFeaturesRecursive(curTzData, quadPos: string) {
Expand Down Expand Up @@ -147,7 +152,7 @@ function loadFeatures(
*/
export function findUsingDataset(
tzData: any,
featureCache: any,
featureCache: MapLike,
featureFilePath: string,
lat: number,
lon: number,
Expand Down

0 comments on commit d55121a

Please sign in to comment.