Problem with Typescript
raymondsze opened this issue · 2 comments
raymondsze commented
The output of index.d.ts.
The import React from 'react';
should be import * as React from 'react'
, as React module does not export default module.
We should not assume user enabled the allowSyntheticDefaultImports
setting in ts-config.
Thanks.
/// <reference types="react" />
import React from 'react';
import { ReactElement } from 'react';
export declare type ChildrenFn<P> = (props: P) => JSX.Element | null;
export declare type RPC<RP, P = {}> = React.ComponentType<P & {
children?: ChildrenFn<RP>;
render?: ChildrenFn<RP>;
}>;
export declare type MapperComponent<RP, P> = React.ComponentType<RP & P & {
render?: ChildrenFn<any>;
}>;
export declare type MapperValue<RP, P> = ReactElement<any> | MapperComponent<RP, P>;
export declare type Mapper<RP, P> = Record<string, MapperValue<RP, P>>;
export declare type MapProps<RP> = (props: any) => RP;
export declare function adopt<RP = any, P = any>(mapper: Mapper<RP, P>, mapProps?: MapProps<RP>): RPC<RP, P>;
export declare type AdoptProps<RP, P> = P & {
mapper: Mapper<RP, P>;
children?: ChildrenFn<RP>;
render?: ChildrenFn<RP>;
mapProps?: MapProps<RP>;
};
export declare class Adopt extends React.Component<AdoptProps<any, any>> {
private Composed;
constructor(props: any);
render(): JSX.Element;
}
fattenap commented
It does not look like the changes made to index.tsx, for version 0.6.0, 9 months ago did not make it to npm
raymondsze commented
seems the owner doesn't actively maintain this module. React hook is released and I haven't use react-adopt at this moment.