Created
January 22, 2019 20:20
-
-
Save danvk/39a73aeebdf02cd4f429851bf8471140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inferKeys = <V extends {}>() => <K extends string>(x: Record<K,V>): Record<K,V> => x; | |
const INIT_VIEW = inferKeys<Partial<MapProps>>()({ | |
nyc: { | |
center: [-73.991284, 40.741263], | |
zoom: [14.5], | |
pitch: [45], | |
bearing: [-17.6], | |
}, | |
sf: { | |
center: [-73.991284, 40.741263], | |
zoom: [14.5], | |
pitch: [45], | |
bearing: [-17.6], | |
} | |
}); | |
export function render(): JSX.Element { | |
return ( | |
<Map | |
style="mapbox://styles/mapbox/streets-v9" | |
{...INIT_VIEW.nyc} // ok | |
> | |
{ /* ... */ } | |
</Map> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment