From 1bc50af06d237a0e9dad12339213bf6290383cae Mon Sep 17 00:00:00 2001 From: Adam Binford Date: Mon, 19 Nov 2018 12:01:59 -0500 Subject: [PATCH 1/2] Added types for react-leaflet-markercluster --- types/react-leaflet-markercluster/index.d.ts | 13 ++++++++ .../react-leaflet-markercluster-tests.tsx | 30 +++++++++++++++++++ .../react-leaflet-markercluster/tsconfig.json | 24 +++++++++++++++ types/react-leaflet-markercluster/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/react-leaflet-markercluster/index.d.ts create mode 100644 types/react-leaflet-markercluster/react-leaflet-markercluster-tests.tsx create mode 100644 types/react-leaflet-markercluster/tsconfig.json create mode 100644 types/react-leaflet-markercluster/tslint.json diff --git a/types/react-leaflet-markercluster/index.d.ts b/types/react-leaflet-markercluster/index.d.ts new file mode 100644 index 0000000000..989605f27c --- /dev/null +++ b/types/react-leaflet-markercluster/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for react-leaflet-markercluster 2.0 +// Project: https://github.com/YUzhva/react-leaflet-markercluster +// Definitions by: Adam Binford +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import 'leaflet.markercluster'; +import * as Leaflet from 'leaflet'; +import * as ReactLeaflet from 'react-leaflet'; + +export type MarkerClusterGroupProps = ReactLeaflet.MapLayerProps & Leaflet.MarkerClusterGroupOptions; + +export default class MarkerClusterGroup

extends ReactLeaflet.MapLayer

{ } diff --git a/types/react-leaflet-markercluster/react-leaflet-markercluster-tests.tsx b/types/react-leaflet-markercluster/react-leaflet-markercluster-tests.tsx new file mode 100644 index 0000000000..9fc901c527 --- /dev/null +++ b/types/react-leaflet-markercluster/react-leaflet-markercluster-tests.tsx @@ -0,0 +1,30 @@ +import * as React from 'react'; +import * as Leaflet from 'leaflet'; +import MarkerClusterGroup from 'react-leaflet-markercluster'; + +const MarkerCluster = ( + Leaflet.divIcon({ html: `${cluster.getChildCount()}` }) }/> +); diff --git a/types/react-leaflet-markercluster/tsconfig.json b/types/react-leaflet-markercluster/tsconfig.json new file mode 100644 index 0000000000..071c9c734d --- /dev/null +++ b/types/react-leaflet-markercluster/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-leaflet-markercluster-tests.tsx" + ] +} diff --git a/types/react-leaflet-markercluster/tslint.json b/types/react-leaflet-markercluster/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-leaflet-markercluster/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8734181e0caf193d3eb8bc65847d23c9b89e9ac3 Mon Sep 17 00:00:00 2001 From: Adam Binford Date: Wed, 21 Nov 2018 18:12:23 -0500 Subject: [PATCH 2/2] react-leaflet-markercluster: Use reference import --- types/react-leaflet-markercluster/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-leaflet-markercluster/index.d.ts b/types/react-leaflet-markercluster/index.d.ts index 989605f27c..5db583d409 100644 --- a/types/react-leaflet-markercluster/index.d.ts +++ b/types/react-leaflet-markercluster/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import 'leaflet.markercluster'; +/// import * as Leaflet from 'leaflet'; import * as ReactLeaflet from 'react-leaflet';