-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working TypeScript example, can't get it to work #119
Comments
Here a TypeScript (TSX) working example using v3.1.0 https://github.com/joseluisq/preact-starter |
I'm having the same issue, using React. It seems as if import * as React from "react";
import { render } from "react-dom";
import createStore from "unistore"
import { connect, Provider } from "unistore/react";
const store = createStore({ bar: "baz" });
const Foo = connect("bar")((props: any) => (
<h1>{props.bar}</h1>
));
// Throws "JSX element type 'Foo' does not have any construct or call signatures. [2604]".
const App = () => (
<Provider store={store}>
<Foo />
</Provider>
);
render(<App />, document.querySelector(".mount")); @types/react: 16.7.7 |
@joseluisq Excuse me for the direct mention. Do you also have a working example in React? |
@stephan281094 No, I don't have one but did you tried this? |
@joseluisq I actually meant an example where they use both React and TypeScript. The example of ReactStateMuseum isn't written in TypeScript. To clarify, I did manage to get unistore working with React in plain javascript, but not with TypeScript due to the error @MarkusWendorf is describing in this issue. |
Sorry by my incomprehension. |
Thanks for the quick response. Your change got rid of the error, great work! Not sure if this change is compatible with previous versions of React though. Might require some research. |
looks like |
I've opened a PR with the above change. |
Awesome, thanks! |
Released as 3.2.0! |
👍 @developit Is #127 issue already fixed too? |
Good evening,
I'm trying to get unistore to work with TypeScript and properly type my store. I would like to ask for some help on my example (Typescript on React).
Repo: Unistore TypeScript
I'm getting an error: TS2604: JSX element type 'App' does not have any construct or call signatures.
If I ignore the error with @ts-ignore everything works as expected.
What am I missing?
PS:
I would appreciate if you would include a working TypeScript example with every release.
The text was updated successfully, but these errors were encountered: