♻️ Misc types improvement (#2120)

This commit is contained in:
yusheng chen 2025-04-08 16:25:09 +08:00 committed by GitHub
parent 43bacc442c
commit fe8469fcde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 7 deletions

View File

@ -360,7 +360,9 @@ const CredentialsItem = ({
const groupCredentialsByType = (
credentials: CredentialsInfo[],
): Record<CredentialsInfo["type"], CredentialsInfo[]> => {
const groupedCredentials: any = {};
const groupedCredentials = {} as {
[key in CredentialsInfo["type"]]: CredentialsInfo[];
};
credentials.forEach((cred) => {
if (!groupedCredentials[cred.type]) {
groupedCredentials[cred.type] = [];

View File

@ -1,12 +1,17 @@
import { Checkbox, Flex } from "@chakra-ui/react";
import { Checkbox, type CheckboxProps, Flex } from "@chakra-ui/react";
import React from "react";
type TableCheckBoxProps = {
indeterminate: boolean;
checked: boolean;
} & Omit<CheckboxProps, "ref" | "isIndeterminate" | "isChecked">;
const TableCheckBox = (
{ indeterminate, checked, ...rest }: any,
{ indeterminate, checked, ...rest }: TableCheckBoxProps,
ref: React.LegacyRef<HTMLInputElement>,
) => {
const defaultRef = React.useRef();
const resolvedRef: any = ref || defaultRef;
const resolvedRef = ref || defaultRef;
return (
<Flex justify="center" data-testid="checkbox">

View File

@ -1,6 +1,7 @@
import { Link } from "@tanstack/react-router";
import type { ReactNode } from "react";
export const NotFound = ({ children }: { children?: any }) => {
export const NotFound = ({ children }: { children?: ReactNode }) => {
return (
<div className="space-y-2 p-2">
<div className="text-gray-600 dark:text-gray-400">

View File

@ -2,8 +2,8 @@ import type { Variable } from "./schemas";
const variableNameRegex = /\{\{([^{}]+)\}\}/g;
export const extractVariableIdReferencesInObject = (
obj: any,
export const extractVariableIdReferencesInObject = <T>(
obj: T,
existingVariables: Variable[],
): string[] =>
[...(JSON.stringify(obj).match(variableNameRegex) ?? [])].reduce<string[]>(