From 086d4331e2cf3b6649e7035d03e46e51a1b8fbd2 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 23 Dec 2019 20:06:57 +0330 Subject: [PATCH] react-map-gl - Added missing types (#40891) * Added missing types Fixed missing types according to https://github.com/uber/react-map-gl/blob/5.1-release/examples/viewport-animation/src/app.js FlyToInterpolator class was missing it's constructor props and transitionDuration property couldn't have 'auto' value * Added tests changed types * Added my name to Definitions by * Reverted the auto-formatted codes, changed 'type' to 'interface' * Removed Unnecessary semicolon * Removed Unnecessary semicolons * Reverted formatting changes on test file --- types/react-map-gl/index.d.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/types/react-map-gl/index.d.ts b/types/react-map-gl/index.d.ts index 4d5268f964..2e7c80d47e 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -4,6 +4,7 @@ // Fabio Berta // Sander Siim // Otto Urpelainen +// Arman Safikhani // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -126,7 +127,7 @@ export interface ViewportProps { minZoom: number; maxPitch: number; minPitch: number; - transitionDuration?: number; + transitionDuration?: number | 'auto'; transitionInterpolator?: TransitionInterpolator; transitionInterruption?: TRANSITION_EVENTS; transitionEasing?: EasingFunction; @@ -215,7 +216,16 @@ export class LinearInterpolator extends TransitionInterpolator { constructor(transitionProps?: string[]); } -export class FlyToInterpolator extends TransitionInterpolator {} +export interface FlyToInterpolatorProps { + curve?: number; + speed?: number; + screenSpeed?: number; + maxDuraiton?: number; +} + +export class FlyToInterpolator extends TransitionInterpolator { + constructor(props?: FlyToInterpolatorProps); +} export interface ViewStateChangeInfo { viewState: ViewportProps; @@ -239,7 +249,7 @@ export interface InteractiveMapProps extends StaticMapProps { onViewStateChange?: ContextViewStateChangeHandler; onViewportChange?: ContextViewportChangeHandler; onInteractionStateChange?: (state: ExtraState) => void; - transitionDuration?: number; + transitionDuration?: number | 'auto'; transitionInterpolator?: TransitionInterpolator; transitionInterruption?: TRANSITION_EVENTS; transitionEasing?: EasingFunction;