Skip to content

Commit e327f67

Browse files
committed
feat: resolve the error prompt of form type
1 parent 0e91e3e commit e327f67

File tree

10 files changed

+171
-453
lines changed

10 files changed

+171
-453
lines changed

packages/ui/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export * from './components/drawer';
3838

3939
export * from './components/dropdown-menu';
4040

41+
export * from './components/form';
42+
4143
export * from './components/hover-card';
4244

4345
export * from './components/icon';

primitives/filed-form /src/Field.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
import { Slot } from '@radix-ui/react-slot';
55
import { useEffect, useId, useRef, useState } from 'react';
6-
import type { AllPaths } from 'skyroc-type-utils';
76
import { capitalize, getEventValue, isEqual, omitUndefined, toArray } from 'skyroc-utils';
87

98
import type { InternalFormInstance } from './FieldContext';
109
import { useFieldContext } from './FieldContext';
1110
import type { InternalFieldProps } from './types/field';
1211
import type { StoreValue } from './types/formStore';
1312

14-
// eslint-disable-next-line prettier/prettier
15-
const Field = <Values=any, T extends AllPaths<Values> = AllPaths<Values>>(props: InternalFieldProps<Values, T>) => {
13+
function Field<Values = any>(props: InternalFieldProps<Values>) {
1614
const {
1715
children,
1816
controlMode = 'uncontrolled',
@@ -169,6 +167,6 @@ const Field = <Values=any, T extends AllPaths<Values> = AllPaths<Values>>(props:
169167
{children}
170168
</Slot>
171169
);
172-
};
170+
}
173171

174172
export default Field;

primitives/filed-form /src/FieldContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export interface InternalCallbacks<Values = any> {
6868

6969
export interface InternalFieldHooks<Values = any> {
7070
dispatch: (action: Action) => void;
71-
getInitialValue: (name: AllPaths<Values>) => PathToDeepType<Values, AllPaths<Values>>;
71+
getInitialValue: <T extends AllPaths<Values>>(name: T) => PathToDeepType<Values, T>;
7272
registerField: (entity: FieldEntity) => () => void;
7373
setFieldRules: (name: AllPaths<Values>, rules?: Rule[]) => void;
7474
}

0 commit comments

Comments
 (0)