SolidJS provides detailed directives documentation:
_
One of the examples is the model directive:
<input type="text" use:model={[name, setName]} />;
declare module "solid-js" {
namespace JSX {
interface Directives {
model: [() => any, (v: any) => any];
}
}
}
In order to eliminate JSX errors, you can include the following code snippet before the component:
type ValidationFunction = ({ value }: { value: string; }) => Promise<unknown>;
declare module "solid-js" {
namespace JSX {
interface Directives {
formSubmit: (form: HTMLFormElement) => void;
validate: ValidationFunction[];
}
}
}
Although, there might still be errors related to directive names, such as:
formSubmit is declared but its value is never read.
Even though it is used as a directive in the jsx.
To address this issue, you can either ignore it using "// @ts-ignore" like:
// @ts-ignore
const { validate, formSubmit, errors } = useForm({
Or simply make it appear as a used variable with:
true && formSubmit