Skip to content

Commit f458c85

Browse files
authored
Merge pull request #144 from tjinauyeung/fix/140-update-handle-change-type
2 parents 544a17f + a987d4b commit f458c85

File tree

7 files changed

+3638
-2814
lines changed

7 files changed

+3638
-2814
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.eslintrc.js

.eslintrc.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ module.exports = {
33

44
ignorePatterns: ['test/**/*.js'],
55

6-
extends: ['eslint:recommended', 'plugin:unicorn/recommended', 'prettier'],
6+
extends: [
7+
'eslint:recommended',
8+
'plugin:@typescript-eslint/recommended',
9+
'plugin:unicorn/recommended',
10+
'prettier',
11+
],
12+
13+
parser: '@typescript-eslint/parser',
14+
plugins: ['@typescript-eslint'],
715

816
rules: {
9-
'unicorn/no-reduce': ['off'],
17+
'unicorn/no-array-reduce': ['off'],
1018
},
1119
};

.husky/commit-msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
commitlint \
4+
$(npm bin)/commitlint \
55
--help-url="https://github.com/tjinauyeung/svelte-forms-lib/#commit-message-conventions" \
66
--edit "$1"

lib/index.d.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {SvelteComponentTyped} from 'svelte';
33
import type {Readable, Writable} from 'svelte/store';
44
import type {ObjectSchema} from 'yup';
55

6-
export type FormProps<Inf = Record<string, any>> = {
6+
export type FormProps<Inf = Record<string, unknown>> = {
77
context?: FormState;
88
initialValues?: Inf;
99
onSubmit?: ((values: Inf) => any) | ((values: Inf) => Promise<any>);
@@ -54,7 +54,7 @@ type FormState<Inf = Record<string, any>> = {
5454
isValidating: boolean;
5555
isModified: boolean;
5656
}>;
57-
handleChange: () => void;
57+
handleChange: () => any;
5858
handleSubmit: () => any;
5959
};
6060

@@ -67,25 +67,33 @@ declare function createForm<Inf = Record<string, any>>(formProps: {
6767

6868
declare class Form extends SvelteComponentTyped<
6969
FormProps,
70-
{},
70+
Record<string, unknown>,
7171
{
7272
default: FormState;
7373
}
7474
> {}
7575

76-
declare class Field extends SvelteComponentTyped<FieldProps, {}, {}> {}
76+
declare class Field extends SvelteComponentTyped<
77+
FieldProps,
78+
Record<string, unknown>,
79+
Record<string, unknown>
80+
> {}
7781

78-
declare class Textarea extends SvelteComponentTyped<TextareaProps, {}, {}> {}
82+
declare class Textarea extends SvelteComponentTyped<
83+
TextareaProps,
84+
Record<string, unknown>,
85+
Record<string, unknown>
86+
> {}
7987

8088
declare class Select extends SvelteComponentTyped<
8189
SelectProps,
82-
{},
90+
Record<string, unknown>,
8391
{default: any}
8492
> {}
8593

8694
declare class ErrorMessage extends SvelteComponentTyped<
8795
ErrorProps,
88-
{},
96+
Record<string, unknown>,
8997
{default: any}
9098
> {}
9199

lib/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import {key} from './components/key';
2-
1+
export {key} from './components/key';
32
export {createForm} from './create-form';
43

54
export {default as Form} from './components/Form.svelte';
65
export {default as Textarea} from './components/Textarea.svelte';
76
export {default as Field} from './components/Field.svelte';
87
export {default as Select} from './components/Select.svelte';
98
export {default as ErrorMessage} from './components/ErrorMessage.svelte';
10-
export {key};

0 commit comments

Comments
 (0)