diff --git a/package.json b/package.json index d3a9c56..132a028 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "prepublish": "npm run compile", "release": "standard-version" }, + "types": "types/index.d.ts", "homepage": "http://github.com/mongodb-js/connect-backbone-to-react", "repository": { "type": "git", diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..2510aab --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,21 @@ +import { type FunctionComponentElement, type ProviderProps, type PropsWithChildren } from "react"; + +interface Options { + debounce?: boolean, + events?: Record> + modelTypes?: Record, + withRef?: boolean +} + +export declare function connectBackboneToReact( + mapModelToProps: (models: Model, props: ModelProps) => Partial, options?: Options +): ( + wrappedComponent: React.ComponentType +) => React.ComponentType>; + + +interface BackboneProviderProps { + models: Models +} + +export declare function BackboneProvider(props: PropsWithChildren>): FunctionComponentElement>;