From bb01448050dee8bb2d566a5ed30351c947bc4213 Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Sun, 2 Mar 2025 10:51:23 +0200 Subject: [PATCH] fix(types): default checkbox value prop type to boolean closes #144 --- .changeset/strange-shoes-compete.md | 5 +++++ packages/core/src/useCheckbox/useCheckbox.spec.ts | 4 ++-- packages/core/src/useCheckbox/useCheckbox.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/strange-shoes-compete.md diff --git a/.changeset/strange-shoes-compete.md b/.changeset/strange-shoes-compete.md new file mode 100644 index 00000000..d512dd46 --- /dev/null +++ b/.changeset/strange-shoes-compete.md @@ -0,0 +1,5 @@ +--- +'@formwerk/core': patch +--- + +fix(types): default checkbox value prop type to boolean diff --git a/packages/core/src/useCheckbox/useCheckbox.spec.ts b/packages/core/src/useCheckbox/useCheckbox.spec.ts index 6c0deb7d..c168dcba 100644 --- a/packages/core/src/useCheckbox/useCheckbox.spec.ts +++ b/packages/core/src/useCheckbox/useCheckbox.spec.ts @@ -24,7 +24,7 @@ const CustomBase: string = ` `; -const createCheckbox = (props: CheckboxProps, template = InputBase): Component => { +function createCheckbox(props: CheckboxProps, template = InputBase): Component { return defineComponent({ template, inheritAttrs: false, @@ -37,7 +37,7 @@ const createCheckbox = (props: CheckboxProps, template = InputBase): Component = }; }, }); -}; +} describe('has no a11y violations', () => { test('with input as base element', async () => { diff --git a/packages/core/src/useCheckbox/useCheckbox.ts b/packages/core/src/useCheckbox/useCheckbox.ts index 18660940..c22b696a 100644 --- a/packages/core/src/useCheckbox/useCheckbox.ts +++ b/packages/core/src/useCheckbox/useCheckbox.ts @@ -15,7 +15,7 @@ import { useFormField, exposeField, FormField } from '../useFormField'; import { FieldTypePrefixes } from '../constants'; import { useInputValidity } from '../validation'; -export interface CheckboxProps { +export interface CheckboxProps { /** * The name/path of the checkbox field. */