You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
Hey folks,
I've been playing with Mithril for the first time, trying to set up a basic project. I'm coming from React and TSX so trying to keep things as familiar as possible as I get started but I'm seeing a lot of TypeScript errors that I don't know how to resolve. The app does compile and run though, so that's cool 🤘
Am I trying to do something that's not supported? Or is there something I should be changing? Any help much appreciated!
In Test.tsx I'm trying to use mithril-tsx-component but I get
Property '__tsx_attrs' is missing in type '{ view: () => JSX.Element; }' but required in type 'MithrilTsxComponent<IFooCompAttrs>'.ts(2741)
import * as m from "mithril";
import { MithrilTsxComponent } from "mithril-tsx-component";
export interface IFooCompAttrs {
attrs: {};
}
export function Test({}: IFooCompAttrs): MithrilTsxComponent<IFooCompAttrs> {
return {
view: () => <div>Hello World!</div>,
};
}
In Button.tsx I tried a plain approach but got a different error
'Btn' cannot be used as a JSX component. Its instance type 'Button' is not a valid JSX element. Type 'Button' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.ts(2786)
import * as m from "mithril";
import { Button as Btn } from "construct-ui";
interface Attrs {
attrs: {
onclick: () => void;
};
}
function Button({ attrs: { onclick } }: Attrs): m.Component<Attrs> {
const state = {
count: 0,
};
const handleClick = () => {
state.count++;
onclick();
};
return {
view: () => (
<Btn onclick={handleClick} fluid label={`Click me (${state.count})`} />
),
};
}
export default Button;
And in App.tsx all custom components complain something along the lines of
'Button' cannot be used as a JSX component. Its return type 'Component<Attrs, {}>' is not a valid JSX element. Type 'Component<Attrs, {}>' is missing the following properties from type 'Element': tag, attrs, state, type, propsts(2786)
The text was updated successfully, but these errors were encountered:
Hey folks,
I've been playing with Mithril for the first time, trying to set up a basic project. I'm coming from React and TSX so trying to keep things as familiar as possible as I get started but I'm seeing a lot of TypeScript errors that I don't know how to resolve. The app does compile and run though, so that's cool 🤘
Am I trying to do something that's not supported? Or is there something I should be changing? Any help much appreciated!
I have a demo repo here - https://github.com/Vazerthon/mithril-test
In
Test.tsx
I'm trying to use mithril-tsx-component but I getProperty '__tsx_attrs' is missing in type '{ view: () => JSX.Element; }' but required in type 'MithrilTsxComponent<IFooCompAttrs>'.ts(2741)
In
Button.tsx
I tried a plain approach but got a different error'Btn' cannot be used as a JSX component. Its instance type 'Button' is not a valid JSX element. Type 'Button' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.ts(2786)
And in
App.tsx
all custom components complain something along the lines of'Button' cannot be used as a JSX component. Its return type 'Component<Attrs, {}>' is not a valid JSX element. Type 'Component<Attrs, {}>' is missing the following properties from type 'Element': tag, attrs, state, type, propsts(2786)
The text was updated successfully, but these errors were encountered: