@mappable-world/mappable-types 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type TReact from "react";
|
|
2
2
|
import type { LngLat, MMapEntity } from "../../../..";
|
|
3
|
-
import type { CustomReactify } from "../../../../reactify/reactify";
|
|
3
|
+
import type { CustomReactify, OverrideProps } from "../../../../reactify/reactify";
|
|
4
4
|
import type { Feature } from "../interface";
|
|
5
5
|
import type { MMapClusterer as MMapClustererI, MMapClustererProps } from "../MMapClusterer";
|
|
6
6
|
/**
|
|
@@ -33,12 +33,12 @@ import type { MMapClusterer as MMapClustererI, MMapClustererProps } from "../MMa
|
|
|
33
33
|
* </MMap>
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
type MMapClustererReactifiedProps = MMapClustererProps
|
|
36
|
+
type MMapClustererReactifiedProps = OverrideProps<MMapClustererProps, {
|
|
37
37
|
/** Function that returns MMapMarker react component to render marker*/
|
|
38
38
|
marker: (feature: Feature) => TReact.ReactElement;
|
|
39
39
|
/** Function that returns MMapMarker react component to render cluster*/
|
|
40
40
|
cluster: (coordinates: LngLat, features: Feature[]) => TReact.ReactElement;
|
|
41
|
-
}
|
|
41
|
+
}>;
|
|
42
42
|
type MMapClustererR = TReact.ForwardRefExoticComponent<MMapClustererReactifiedProps & React.RefAttributes<MMapEntity<MMapClustererReactifiedProps>>>;
|
|
43
43
|
export declare const MMapClustererReactifyOverride: CustomReactify<MMapClustererI, MMapClustererR>;
|
|
44
44
|
export {};
|
package/reactify/reactify.d.ts
CHANGED
|
@@ -26,20 +26,21 @@ export type CustomReactify<TEntity extends GenericEntity<unknown>, TResult> = (c
|
|
|
26
26
|
React: typeof TReact;
|
|
27
27
|
ReactDOM: typeof TReactDOM;
|
|
28
28
|
}) => TResult;
|
|
29
|
-
export type Overrided<TReactResult> = {
|
|
30
|
-
[overrideKeyReactify]: CustomReactify<
|
|
29
|
+
export type Overrided<TCtor extends EntityConstructor<GenericEntity<unknown>>, TReactResult> = {
|
|
30
|
+
[overrideKeyReactify]: CustomReactify<InstanceType<TCtor>, TReactResult>;
|
|
31
31
|
};
|
|
32
32
|
type InternalReactify<TEntity extends GenericEntity<unknown>> = (ctor: EntityConstructor<TEntity>, displayName?: string) => TReact.ForwardRefExoticComponent<TReact.PropsWithoutRef<TReact.PropsWithChildren<EntityProps<TEntity>>> & React.RefAttributes<TEntity | undefined>>;
|
|
33
|
-
type InternalReactifyEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = (ctor: TCtor, displayName?: string) => TCtor extends Overrided<infer TResult> ? TResult : ReturnType<InternalReactify<InstanceType<TCtor>>>;
|
|
33
|
+
type InternalReactifyEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = (ctor: TCtor, displayName?: string) => TCtor extends Overrided<TCtor, infer TResult> ? TResult : ReturnType<InternalReactify<InstanceType<TCtor>>>;
|
|
34
34
|
export type ReactifyEntity = <TCtor extends EntityConstructor<GenericEntity<unknown>>>(...args: Parameters<InternalReactifyEntity<TCtor>>) => ReturnType<InternalReactifyEntity<TCtor>>;
|
|
35
35
|
export type ReactifiedEntity<TCtor extends EntityConstructor<GenericEntity<unknown>>> = ReturnType<InternalReactifyEntity<TCtor>>;
|
|
36
|
-
export interface ReactifyModule
|
|
37
|
-
(module: TModule): ReactifiedModule<TModule>;
|
|
36
|
+
export interface ReactifyModule {
|
|
37
|
+
<TModule extends BaseModule = BaseModule>(module: TModule): ReactifiedModule<TModule>;
|
|
38
38
|
}
|
|
39
39
|
export type GetReactContext<TContext extends Context<unknown>> = (context?: TContext | undefined) => React.Context<unknown>;
|
|
40
40
|
export type ReactifiedModule<TModule extends BaseModule> = {
|
|
41
41
|
[Property in keyof TModule]: TModule[Property] extends EntityConstructor<GenericEntity<unknown>> ? ReturnType<InternalReactifyEntity<TModule[Property]>> : TModule[Property] extends typeof Context ? ReturnType<GetReactContext<TModule[Property]>> : TModule[Property];
|
|
42
42
|
};
|
|
43
43
|
export type BaseModule = Record<string | symbol, unknown>;
|
|
44
|
+
export type OverrideProps<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
44
45
|
export default function createReactify(React: typeof TReact, ReactDOM: typeof TReactDOM): Reactify;
|
|
45
46
|
export {};
|