Skip to content

Commit

Permalink
fix(types): default checkbox value prop type to boolean closes #144
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Mar 2, 2025
1 parent c6e1853 commit bb01448
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-shoes-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@formwerk/core': patch
---

fix(types): default checkbox value prop type to boolean
4 changes: 2 additions & 2 deletions packages/core/src/useCheckbox/useCheckbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CustomBase: string = `
</div>
`;

const createCheckbox = (props: CheckboxProps, template = InputBase): Component => {
function createCheckbox<TValue = boolean>(props: CheckboxProps<TValue>, template = InputBase): Component {
return defineComponent({
template,
inheritAttrs: false,
Expand All @@ -37,7 +37,7 @@ const createCheckbox = (props: CheckboxProps, template = InputBase): Component =
};
},
});
};
}

describe('has no a11y violations', () => {
test('with input as base element', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/useCheckbox/useCheckbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useFormField, exposeField, FormField } from '../useFormField';
import { FieldTypePrefixes } from '../constants';
import { useInputValidity } from '../validation';

export interface CheckboxProps<TValue = string> {
export interface CheckboxProps<TValue = boolean> {
/**
* The name/path of the checkbox field.
*/
Expand Down

0 comments on commit bb01448

Please sign in to comment.