Skip to content
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

Typed <option> elements #3

Open
CodeStix opened this issue Apr 7, 2021 · 0 comments
Open

Typed <option> elements #3

CodeStix opened this issue Apr 7, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@CodeStix
Copy link
Owner

CodeStix commented Apr 7, 2021

When using a FormSelect, its name field is type checked, but its options are not.

type FormData = {
    enum: "option1" | "option2" | "option3";
};
const form = useForm({ enum: "option1" } as FormData);
// ...
<FormSelect form={form} name="enum">
    <option value="option1">Option 1</option>
    <option value="option2">Option 2</option>
    <option value="option3">Option 3</option>
    {/* Next line does not show error, but option4 is invalid! */}
    <option value="option4">Option 4</option>
</FormSelect>;

This should be possible to typecheck by only accepting children of a specific type in FormSelect.

@CodeStix CodeStix added the enhancement New feature or request label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant