Looking to create a TypeScript Declaration for ReactMeteorData.jsx, which consists of the following exporting functionality:
export default function connect(options) {
let expandedOptions = options;
if (typeof options === 'function') {
expandedOptions = {
getMeteorData: options,
};
}
const { getMeteorData, pure = true } = expandedOptions;
const BaseComponent = pure ? ReactPureComponent : ReactComponent;
return (WrappedComponent) => (
class ReactMeteorDataComponent extends BaseComponent {
...
}
);
}
This is then repackaged as withTracker by react-meteor-data.jsx:
export { default as withTracker } from './ReactMeteorData.jsx';
In order to handle this in my declaration without modifying the original package, I can simply define the return value as Function:
declare module 'meteor/react-meteor-data' {
import * as React from 'react';
export function withTracker(func: () => {}): Function;
...
}
Is there a way to declare the arguments and returns of the Function without changing the original package? Ideally, it would look something like this:
export function withTracker(func: () => {}): (React.Component) => { React.Component };
The code is used as shown below:
import * as React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
class Header extends React.Component<any,any> {
render() {
return "test";
}
}
export default withTracker(() => {
return { user: 1 };
})(Header);
Appreciate any guidance you can provide!