react-map-interaction
react-map-interaction copied to clipboard
Need Types For Typescript
This packages doesn't have d.ts files
For reference, this is what I'm using for now:
declare module 'react-map-interaction' {
type Translation = {
x: number;
y: number;
};
export type MapInteractionProps = {
children?: ({
scale,
translation,
}: {
scale: number;
translation: Translation;
}) => import('react').ReactNode;
value?: {
scale: number;
translation: Translation;
};
defaultValue?: {
scale: number;
translation: Translation;
};
disableZoom?: boolean;
disablePan?: boolean;
translationBounds?: {
xMin?: number;
xMax?: number;
yMin?: number;
yMax?: number;
};
onChange?: ({
scale,
translation,
}: {
scale: number;
translation: Translation;
}) => void;
minScale?: number;
maxScale?: number;
showControls?: boolean;
plusBtnContents?: import('react').ReactNode;
minusBtnContents?: import('react').ReactNode;
controlsClass?: string;
btnClass?: string;
plusBtnClass?: string;
minusBtnClass?: string;
};
export const MapInteraction: import('react').FC<MapInteractionProps>;
export type MapInteractionCSSProps = import('react').PropsWithChildren<
Omit<MapInteractionProps, 'children'>
>;
export const MapInteractionCSS: import('react').FC<MapInteractionCSSProps>;
export default MapInteraction;
}
Thanks @ghost91-
Added ScaleTranslation:
declare module 'react-map-interaction' {
export type Translation = {
x: number;
y: number;
};
export type ScaleTranslation = {
scale: number;
translation: Translation;
};
export type MapInteractionProps = {
children?: (scaleTranslation: ScaleTranslation) => import('react').ReactNode;
value?: ScaleTranslation;
defaultValue?: ScaleTranslation;
disableZoom?: boolean;
disablePan?: boolean;
translationBounds?: {
xMin?: number;
xMax?: number;
yMin?: number;
yMax?: number;
};
onChange?: (scaleTranslation: ScaleTranslation) => void;
minScale?: number;
maxScale?: number;
showControls?: boolean;
plusBtnContents?: import('react').ReactNode;
minusBtnContents?: import('react').ReactNode;
controlsClass?: string;
btnClass?: string;
plusBtnClass?: string;
minusBtnClass?: string;
};
export const MapInteraction: import('react').FC<MapInteractionProps>;
export type MapInteractionCSSProps = import('react').PropsWithChildren<Omit<MapInteractionProps, 'children'>>;
export const MapInteractionCSS: import('react').FC<MapInteractionCSSProps>;
export default MapInteraction;
}
Would be great if the package can be updated with full TS support.