Skip to content

Commit

Permalink
docs: update faq (ant-design#44198)
Browse files Browse the repository at this point in the history
* docs: update faq

* chore: update lint

* chore: update lint

* chore: use returnType
  • Loading branch information
zombieJ authored Aug 14, 2023
1 parent 56f2bc5 commit 72b449a
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/IconSearch/Category.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Category: React.FC<CategoryProps> = (props) => {
const { icons, title, newIcons, theme } = props;
const intl = useIntl();
const [justCopied, setJustCopied] = React.useState<string | null>(null);
const copyId = React.useRef<NodeJS.Timeout | null>(null);
const copyId = React.useRef<ReturnType<typeof setTimeout> | null>(null);
const onCopied = React.useCallback((type: string, text: string) => {
message.success(
<span>
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/layouts/DocLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const DocLayout: React.FC = () => {
const location = useLocation();
const { pathname, search, hash } = location;
const [locale, lang] = useLocale(locales);
const timerRef = useRef<NodeJS.Timeout | null>(null);
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const { direction } = useContext(SiteContext);
const { loading } = useSiteData();

Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/slots/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const Header: React.FC = () => {
searching: false,
});
const { direction, isMobile, updateSiteConfig } = useContext<SiteContextProps>(SiteContext);
const pingTimer = useRef<NodeJS.Timeout | null>(null);
const pingTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const location = useLocation();
const { pathname, search } = location;

Expand Down
2 changes: 1 addition & 1 deletion components/_util/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ActionButton: React.FC<ActionButtonProps> = (props) => {
};

React.useEffect(() => {
let timeoutId: NodeJS.Timer | null = null;
let timeoutId: ReturnType<typeof setTimeout> | null = null;
if (autoFocus) {
timeoutId = setTimeout(() => {
buttonRef.current?.focus();
Expand Down
2 changes: 1 addition & 1 deletion components/affix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {

private fixedNodeRef = createRef<HTMLDivElement>();

private timer: NodeJS.Timeout | null;
private timer: ReturnType<typeof setTimeout> | null;

context: ConfigConsumerProps;

Expand Down
2 changes: 1 addition & 1 deletion components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const InternalButton: React.ForwardRefRenderFunction<
const needInserted = Children.count(children) === 1 && !icon && !isUnBorderedButtonType(type);

useEffect(() => {
let delayTimer: NodeJS.Timer | null = null;
let delayTimer: ReturnType<typeof setTimeout> | null = null;
if (loadingOrDelay.delay > 0) {
delayTimer = setTimeout(() => {
delayTimer = null;
Expand Down
4 changes: 2 additions & 2 deletions components/form/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ Provide linkage between forms. If a sub form with `name` prop update, it will au
| resetFields | Reset fields to `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | |
| scrollToField | Scroll to field position | (name: [NamePath](#namepath), options: \[[ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)]) => void | |
| setFields | Set fields status | (fields: [FieldData](#fielddata)\[]) => void | |
| setFieldValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
| setFieldsValue | Set fields value(Will directly pass to form store. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | |
| setFieldValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
| setFieldsValue | Set fields value(Will directly pass to form store and **reset validation message**. If you do not want to modify passed object, please clone first). Use `setFieldValue` instead if you want to only config single value in Form.List | (values) => void | |
| submit | Submit the form. It's same as click `submit` button | () => void | |
| validateFields | Validate fields | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 |

Expand Down
4 changes: 2 additions & 2 deletions components/form/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ Form.List 渲染表单相关操作函数。
| resetFields | 重置一组字段到 `initialValues` | (fields?: [NamePath](#namepath)\[]) => void | |
| scrollToField | 滚动到对应字段位置 | (name: [NamePath](#namepath), options: [ScrollOptions](https://github.com/stipsan/scroll-into-view-if-needed/tree/ece40bd9143f48caf4b99503425ecb16b0ad8249#options)) => void | |
| setFields | 设置一组字段状态 | (fields: [FieldData](#fielddata)\[]) => void | |
| setFieldValue | 设置表单的值(该值将直接传入 form store 。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
| setFieldsValue | 设置表单的值(该值将直接传入 form store 。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | |
| setFieldValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入) | (name: [NamePath](#namepath), value: any) => void | 4.22.0 |
| setFieldsValue | 设置表单的值(该值将直接传入 form store 中并且**重置错误信息**。如果你不希望传入对象被修改,请克隆后传入)。如果你只想修改 Form.List 中单项值,请通过 `setFieldValue` 进行指定 | (values) => void | |
| submit | 提交表单,与点击 `submit` 按钮效果相同 | () => void | |
| validateFields | 触发表单验证 | (nameList?: [NamePath](#namepath)\[], { validateOnly?: boolean }) => Promise | `validateOnly`: 5.5.0 |

Expand Down
2 changes: 1 addition & 1 deletion components/input/hooks/useRemovePasswordTimeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function useRemovePasswordTimeout(
inputRef: React.RefObject<InputRef>,
triggerOnMount?: boolean,
) {
const removePasswordTimeoutRef = useRef<NodeJS.Timer[]>([]);
const removePasswordTimeoutRef = useRef<ReturnType<typeof setTimeout>[]>([]);
const removePasswordTimeout = () => {
removePasswordTimeoutRef.current.push(
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion components/modal/confirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function confirm(config: ModalFuncProps) {
const container = document.createDocumentFragment();
// eslint-disable-next-line @typescript-eslint/no-use-before-define
let currentConfig = { ...config, close, open: true } as any;
let timeoutId: NodeJS.Timeout;
let timeoutId: ReturnType<typeof setTimeout>;

function destroy(...args: any[]) {
const triggerCancel = args.some((param) => param && param.triggerCancel);
Expand Down
2 changes: 1 addition & 1 deletion components/statistic/Countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Countdown: React.FC<CountdownProps> = (props) => {

const forceUpdate = useForceUpdate();

const countdown = React.useRef<NodeJS.Timer | null>(null);
const countdown = React.useRef<ReturnType<typeof setTimeout> | null>(null);

const stopTimer = () => {
onFinish?.();
Expand Down
2 changes: 1 addition & 1 deletion components/typography/Base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
// ========================== Copyable ==========================
const [enableCopy, copyConfig] = useMergedConfig<CopyConfig>(copyable);
const [copied, setCopied] = React.useState(false);
const copyIdRef = React.useRef<NodeJS.Timeout | null>(null);
const copyIdRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);

const copyOptions: Pick<CopyConfig, 'format'> = {};
if (copyConfig.format) {
Expand Down

0 comments on commit 72b449a

Please sign in to comment.