Skip to content

Commit

Permalink
Merge pull request #144 from tjinauyeung/fix/140-update-handle-change…
Browse files Browse the repository at this point in the history
…-type
  • Loading branch information
larrybotha authored Nov 7, 2021
2 parents 544a17f + a987d4b commit f458c85
Show file tree
Hide file tree
Showing 7 changed files with 3,638 additions and 2,814 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.eslintrc.js
12 changes: 10 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ module.exports = {

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

extends: ['eslint:recommended', 'plugin:unicorn/recommended', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:unicorn/recommended',
'prettier',
],

parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],

rules: {
'unicorn/no-reduce': ['off'],
'unicorn/no-array-reduce': ['off'],
},
};
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

commitlint \
$(npm bin)/commitlint \
--help-url="https://github.com/tjinauyeung/svelte-forms-lib/#commit-message-conventions" \
--edit "$1"
22 changes: 15 additions & 7 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {SvelteComponentTyped} from 'svelte';
import type {Readable, Writable} from 'svelte/store';
import type {ObjectSchema} from 'yup';

export type FormProps<Inf = Record<string, any>> = {
export type FormProps<Inf = Record<string, unknown>> = {
context?: FormState;
initialValues?: Inf;
onSubmit?: ((values: Inf) => any) | ((values: Inf) => Promise<any>);
Expand Down Expand Up @@ -54,7 +54,7 @@ type FormState<Inf = Record<string, any>> = {
isValidating: boolean;
isModified: boolean;
}>;
handleChange: () => void;
handleChange: () => any;
handleSubmit: () => any;
};

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

declare class Form extends SvelteComponentTyped<
FormProps,
{},
Record<string, unknown>,
{
default: FormState;
}
> {}

declare class Field extends SvelteComponentTyped<FieldProps, {}, {}> {}
declare class Field extends SvelteComponentTyped<
FieldProps,
Record<string, unknown>,
Record<string, unknown>
> {}

declare class Textarea extends SvelteComponentTyped<TextareaProps, {}, {}> {}
declare class Textarea extends SvelteComponentTyped<
TextareaProps,
Record<string, unknown>,
Record<string, unknown>
> {}

declare class Select extends SvelteComponentTyped<
SelectProps,
{},
Record<string, unknown>,
{default: any}
> {}

declare class ErrorMessage extends SvelteComponentTyped<
ErrorProps,
{},
Record<string, unknown>,
{default: any}
> {}

Expand Down
4 changes: 1 addition & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {key} from './components/key';

export {key} from './components/key';
export {createForm} from './create-form';

export {default as Form} from './components/Form.svelte';
export {default as Textarea} from './components/Textarea.svelte';
export {default as Field} from './components/Field.svelte';
export {default as Select} from './components/Select.svelte';
export {default as ErrorMessage} from './components/ErrorMessage.svelte';
export {key};
Loading

0 comments on commit f458c85

Please sign in to comment.