Skip to content

Commit

Permalink
Fix reactify override
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew44-mappable committed Mar 25, 2024
1 parent de948fc commit 33e9f64
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 26 deletions.
97 changes: 82 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
"bump:git": "git add --all && git commit -m \"New version $npm_package_version\" && git tag $npm_package_version && git push --tags origin HEAD:main"
},
"devDependencies": {
"@mappable-world/mappable-cli": "^0.0.29",
"@mappable-world/mappable-types": "^0.0.4",
"@mappable-world/mappable-cli": "^0.0.32",
"@mappable-world/mappable-types": "^0.0.15",
"@types/got": "9.6.12",
"@types/jest": "29.5.3",
"@types/jsdom": "21.1.1",
"@types/react": "18.2.14",
"@types/react-dom": "18.2.6",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"@vue/runtime-core": "^3.4.21",
"cross-fetch": "4.0.0",
"css-loader": "6.8.1",
"dotenv": "16.3.1",
Expand Down
19 changes: 12 additions & 7 deletions src/MMapClusterer/react/MMapClusterer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type TReact from 'react';
import type {LngLat, MMapEntity} from '@mappable-world/mappable-types';
import type {CustomReactify} from '@mappable-world/mappable-types/reactify/reactify';
import type {CustomReactify, OverrideProps, Prettify} from '@mappable-world/mappable-types/reactify/reactify';

import type {ClustererObject, Feature} from '../interface';
import type {MMapClusterer as MMapClustererI, MMapClustererProps} from '../MMapClusterer';
Expand Down Expand Up @@ -36,12 +36,17 @@ import type {MMapClusterer as MMapClustererI, MMapClustererProps} from '../MMapC
* ```
*/

type MMapClustererReactifiedProps = Omit<MMapClustererProps, 'marker' | 'cluster'> & {
/** Function that returns MMapMarker react component to render marker*/
marker: (feature: Feature) => TReact.ReactElement;
/** Function that returns MMapMarker react component to render cluster*/
cluster: (coordinates: LngLat, features: Feature[]) => TReact.ReactElement;
};
type MMapClustererReactifiedProps = Prettify<
OverrideProps<
MMapClustererProps,
{
/** Function that returns MMapMarker react component to render marker*/
marker: (feature: Feature) => TReact.ReactElement;
/** Function that returns MMapMarker react component to render cluster*/
cluster: (coordinates: LngLat, features: Feature[]) => TReact.ReactElement;
}
>
>;

type MMapClustererImperative = new (props: MMapClustererReactifiedProps) => MMapEntity<MMapClustererReactifiedProps>;
type MMapClustererR = TReact.ForwardRefExoticComponent<
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": ["@mappable-world/mappable-cli"],
"extends": "@mappable-world/mappable-cli",
"compilerOptions": {
"typeRoots": ["./node_modules/@types", "./node_modules/@mappable-world"]
},
"include": ["./src", "./node_modules/@mappable-world/mappable-cli/index.d.ts"]
"include": ["./src", "./node_modules/@mappable-world/mappable-cli/index.d.ts"]
}

0 comments on commit 33e9f64

Please sign in to comment.