Browse Source

Merge branch 'main' of github.com:DouyinFE/semi-design

pointhalo 3 years ago
parent
commit
cdf40bb1a5
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/semi-ui/form/hooks/useFormApi.tsx

+ 3 - 2
packages/semi-ui/form/hooks/useFormApi.tsx

@@ -1,6 +1,7 @@
+import { BaseFormApi } from '@douyinfe/semi-foundation/form/interface';
 import React, { useContext } from 'react';
 import { FormApiContext } from '../context';
  
-export default function useFormApi() {
-    return useContext(FormApiContext);
+export default function useFormApi<T extends Record<string, any> = any >() {
+    return useContext<BaseFormApi<T>>(FormApiContext);
 }