typed more utils

This commit is contained in:
muerwre 2019-02-21 14:42:59 +07:00
parent 5c3f09ec2c
commit ca9f6627c4
9 changed files with 113 additions and 93 deletions

View file

@ -74,7 +74,7 @@ export const PROVIDERS: Partial<ITileMaps> = ENABLED.reduce((obj, provider) => (
[provider]: TILEMAPS[provider],
}), {});
export const replaceProviderUrl = (provider, { x, y, zoom }) => {
export const replaceProviderUrl = (provider, { x, y, zoom }: { x: number, y: number, zoom: number }): string => {
const { url, range } = (PROVIDERS[provider] || PROVIDERS[DEFAULT_PROVIDER]);
const random: (number | string) = (range && range.length >= 2)
? range[Math.round((Math.random() * (range.length - 1)))]