I am creating a package that contains common components that we created on the company I work for, and we want available for all projects. We use TypeScript, and I moved the code to a new project and I am able to publish to npm and add the package in the dependencies section of one of my projects. However, when I try to use it I get a compile error saying
error TS2604: JSX element type 'Loader' does not have any construct or call signatures.
my code (simplified) looks like this:
import Loader from "my-common-components";
export class Contact extends React.Component<any, any> {
.
.
.
public render() {
this.state.loading) && <Loader />
<div>Hello World</div>
}
}
The linter indicates that the error is on the <Loader /> part, however the code of this component (Contact) didn't change, I just moved Loader away from the project and into a separate package (my-common-components).