diff --git a/cypress/support/util/AdminClient.ts b/cypress/support/util/AdminClient.ts index 8c72d98f3b..9c6b3c238a 100644 --- a/cypress/support/util/AdminClient.ts +++ b/cypress/support/util/AdminClient.ts @@ -1,6 +1,6 @@ import KeycloakAdminClient from "keycloak-admin"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; export default class AdminClient { private client: KeycloakAdminClient; diff --git a/jest.config.ts b/jest.config.ts index 758c55df3f..62ca7b21b4 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,7 +1,7 @@ // See: https://github.com/snowpackjs/snowpack/issues/3242 // @ts-ignore import snowpackConfig from "@snowpack/app-scripts-react/jest.config.js"; -import { Config } from "@jest/types"; +import type { Config } from "@jest/types"; const config: Config.InitialOptions = { ...snowpackConfig(), diff --git a/src/KeycloakAdminConsole.tsx b/src/KeycloakAdminConsole.tsx index 1d84127fc9..e05eb02e8f 100644 --- a/src/KeycloakAdminConsole.tsx +++ b/src/KeycloakAdminConsole.tsx @@ -1,5 +1,5 @@ import React from "react"; -import KeycloakAdminClient from "keycloak-admin"; +import type KeycloakAdminClient from "keycloak-admin"; import { AdminClient } from "./context/auth/AdminClient"; import { WhoAmIContextProvider } from "./context/whoami/WhoAmI"; diff --git a/src/authentication/AuthenticationSection.tsx b/src/authentication/AuthenticationSection.tsx index 0d59cad2b5..c0f8ab6ba3 100644 --- a/src/authentication/AuthenticationSection.tsx +++ b/src/authentication/AuthenticationSection.tsx @@ -13,7 +13,7 @@ import { } from "@patternfly/react-core"; import { CheckCircleIcon } from "@patternfly/react-icons"; -import AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation"; +import type AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs"; diff --git a/src/client-scopes/ClientScopesSection.tsx b/src/client-scopes/ClientScopesSection.tsx index 4ac60e1212..0c2ada94a7 100644 --- a/src/client-scopes/ClientScopesSection.tsx +++ b/src/client-scopes/ClientScopesSection.tsx @@ -12,7 +12,7 @@ import { ToolbarItem, } from "@patternfly/react-core"; import { cellWidth } from "@patternfly/react-table"; -import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; +import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { ViewHeader } from "../components/view-header/ViewHeader"; @@ -26,7 +26,7 @@ import { AllClientScopes, AllClientScopeType, } from "../components/client-scope/ClientScopeTypes"; -import KeycloakAdminClient from "keycloak-admin"; +import type KeycloakAdminClient from "keycloak-admin"; import { ChangeTypeDialog } from "./ChangeTypeDialog"; import "./client-scope.css"; diff --git a/src/client-scopes/add/MapperDialog.tsx b/src/client-scopes/add/MapperDialog.tsx index 384db09f57..f7df694467 100644 --- a/src/client-scopes/add/MapperDialog.tsx +++ b/src/client-scopes/add/MapperDialog.tsx @@ -19,8 +19,8 @@ import { TableVariant, } from "@patternfly/react-table"; import { useTranslation } from "react-i18next"; -import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; -import { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; +import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; +import type { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState"; diff --git a/src/client-scopes/add/RoleMappingForm.tsx b/src/client-scopes/add/RoleMappingForm.tsx index 3f5f1a7c3c..83fe51f55f 100644 --- a/src/client-scopes/add/RoleMappingForm.tsx +++ b/src/client-scopes/add/RoleMappingForm.tsx @@ -18,9 +18,9 @@ import { ValidatedOptions, } from "@patternfly/react-core"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; -import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; import { useAlerts } from "../../components/alert/Alerts"; import { RealmContext } from "../../context/realm-context/RealmContext"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; diff --git a/src/client-scopes/add/__tests__/MapperDialog.test.tsx b/src/client-scopes/add/__tests__/MapperDialog.test.tsx index 1ba8a091af..7afaee0f12 100644 --- a/src/client-scopes/add/__tests__/MapperDialog.test.tsx +++ b/src/client-scopes/add/__tests__/MapperDialog.test.tsx @@ -1,6 +1,7 @@ import React, { useState } from "react"; import { mount } from "enzyme"; import { Button } from "@patternfly/react-core"; +import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import serverInfo from "../../../context/server-info/__tests__/mock.json"; import { ServerInfoContext } from "../../../context/server-info/ServerInfoProvider"; @@ -10,7 +11,9 @@ describe("", () => { const Test = (args: AddMapperDialogModalProps) => { const [open, setOpen] = useState(false); return ( - + { const { t } = useTranslation("client-scopes"); diff --git a/src/clients/AdvancedTab.tsx b/src/clients/AdvancedTab.tsx index 2423365e2d..d0c2cc4931 100644 --- a/src/clients/AdvancedTab.tsx +++ b/src/clients/AdvancedTab.tsx @@ -18,8 +18,8 @@ import { ToolbarItem, } from "@patternfly/react-core"; -import GlobalRequestResult from "keycloak-admin/lib/defs/globalRequestResult"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type GlobalRequestResult from "keycloak-admin/lib/defs/globalRequestResult"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import { convertToFormValues, toUpperCase } from "../util"; import { FormAccess } from "../components/form-access/FormAccess"; import { ScrollForm } from "../components/scroll-form/ScrollForm"; @@ -36,7 +36,7 @@ import { AddHostDialog } from "./advanced/AddHostDialog"; import { FineGrainSamlEndpointConfig } from "./advanced/FineGrainSamlEndpointConfig"; import { AuthenticationOverrides } from "./advanced/AuthenticationOverrides"; import { useRealm } from "../context/realm-context/RealmContext"; -import { SaveOptions } from "./ClientDetails"; +import type { SaveOptions } from "./ClientDetails"; type AdvancedProps = { save: (options?: SaveOptions) => void; diff --git a/src/clients/ClientDescription.tsx b/src/clients/ClientDescription.tsx index deec1ce605..db12d3cb70 100644 --- a/src/clients/ClientDescription.tsx +++ b/src/clients/ClientDescription.tsx @@ -11,7 +11,7 @@ import { import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormAccess } from "../components/form-access/FormAccess"; -import { ClientForm } from "./ClientDetails"; +import type { ClientForm } from "./ClientDetails"; export const ClientDescription = () => { const { t } = useTranslation("clients"); diff --git a/src/clients/ClientDetails.tsx b/src/clients/ClientDetails.tsx index 256974dd16..82eed5bed4 100644 --- a/src/clients/ClientDetails.tsx +++ b/src/clients/ClientDetails.tsx @@ -14,7 +14,7 @@ import { import { useHistory, useParams } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Controller, FormProvider, useForm, useWatch } from "react-hook-form"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import _ from "lodash"; import { ClientSettings } from "./ClientSettings"; diff --git a/src/clients/ClientsSection.tsx b/src/clients/ClientsSection.tsx index 84e84e729d..b2b66675ce 100644 --- a/src/clients/ClientsSection.tsx +++ b/src/clients/ClientsSection.tsx @@ -17,7 +17,7 @@ import { useAdminClient } from "../context/auth/AdminClient"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { emptyFormatter, exportClient, getBaseUrl } from "../util"; import { useAlerts } from "../components/alert/Alerts"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import { formattedLinkTableCell } from "../components/external-link/FormattedLink"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs"; diff --git a/src/clients/add/CapabilityConfig.tsx b/src/clients/add/CapabilityConfig.tsx index 3ba9036af5..63f95259dd 100644 --- a/src/clients/add/CapabilityConfig.tsx +++ b/src/clients/add/CapabilityConfig.tsx @@ -11,7 +11,7 @@ import { } from "@patternfly/react-core"; import { FormAccess } from "../../components/form-access/FormAccess"; -import { ClientForm } from "../ClientDetails"; +import type { ClientForm } from "../ClientDetails"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import "./capability-config.css"; diff --git a/src/clients/add/NewClientForm.tsx b/src/clients/add/NewClientForm.tsx index 76a0e875dc..6c26f14807 100644 --- a/src/clients/add/NewClientForm.tsx +++ b/src/clients/add/NewClientForm.tsx @@ -15,7 +15,7 @@ import { GeneralSettings } from "./GeneralSettings"; import { CapabilityConfig } from "./CapabilityConfig"; import { useAlerts } from "../../components/alert/Alerts"; import { ViewHeader } from "../../components/view-header/ViewHeader"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import { useAdminClient } from "../../context/auth/AdminClient"; import { useRealm } from "../../context/realm-context/RealmContext"; diff --git a/src/clients/advanced/FineGrainSamlEndpointConfig.tsx b/src/clients/advanced/FineGrainSamlEndpointConfig.tsx index 3744b0327d..a585bf81b5 100644 --- a/src/clients/advanced/FineGrainSamlEndpointConfig.tsx +++ b/src/clients/advanced/FineGrainSamlEndpointConfig.tsx @@ -1,6 +1,6 @@ import React from "react"; import { useTranslation } from "react-i18next"; -import { Control } from "react-hook-form"; +import type { Control } from "react-hook-form"; import { ActionGroup, Button, diff --git a/src/clients/credentials/ClientSecret.tsx b/src/clients/credentials/ClientSecret.tsx index dfe2558543..bf9806a4dd 100644 --- a/src/clients/credentials/ClientSecret.tsx +++ b/src/clients/credentials/ClientSecret.tsx @@ -8,7 +8,7 @@ import { SplitItem, } from "@patternfly/react-core"; import { useFormContext } from "react-hook-form"; -import { ClientForm } from "../ClientDetails"; +import type { ClientForm } from "../ClientDetails"; export type ClientSecretProps = { secret: string; diff --git a/src/clients/credentials/Credentials.tsx b/src/clients/credentials/Credentials.tsx index 30ab5759c8..b2f0d8ff27 100644 --- a/src/clients/credentials/Credentials.tsx +++ b/src/clients/credentials/Credentials.tsx @@ -18,7 +18,7 @@ import { Split, SplitItem, } from "@patternfly/react-core"; -import CredentialRepresentation from "keycloak-admin/lib/defs/credentialRepresentation"; +import type CredentialRepresentation from "keycloak-admin/lib/defs/credentialRepresentation"; import { useAlerts } from "../../components/alert/Alerts"; import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog"; diff --git a/src/clients/import/ImportForm.tsx b/src/clients/import/ImportForm.tsx index ad25687e4a..b7fc3f17c7 100644 --- a/src/clients/import/ImportForm.tsx +++ b/src/clients/import/ImportForm.tsx @@ -15,7 +15,7 @@ import { ClientDescription } from "../ClientDescription"; import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { useAlerts } from "../../components/alert/Alerts"; import { ViewHeader } from "../../components/view-header/ViewHeader"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import { useAdminClient } from "../../context/auth/AdminClient"; import { FormAccess } from "../../components/form-access/FormAccess"; import { useRealm } from "../../context/realm-context/RealmContext"; diff --git a/src/clients/initial-access/CreateInitialAccessToken.tsx b/src/clients/initial-access/CreateInitialAccessToken.tsx index 218a99d3f2..330bf84d58 100644 --- a/src/clients/initial-access/CreateInitialAccessToken.tsx +++ b/src/clients/initial-access/CreateInitialAccessToken.tsx @@ -10,7 +10,7 @@ import { PageSection, } from "@patternfly/react-core"; -import ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation"; +import type ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation"; import { FormAccess } from "../../components/form-access/FormAccess"; import { ViewHeader } from "../../components/view-header/ViewHeader"; import { HelpItem } from "../../components/help-enabler/HelpItem"; diff --git a/src/clients/initial-access/InitialAccessTokenList.tsx b/src/clients/initial-access/InitialAccessTokenList.tsx index 7a7e4577c7..c7ca2f1124 100644 --- a/src/clients/initial-access/InitialAccessTokenList.tsx +++ b/src/clients/initial-access/InitialAccessTokenList.tsx @@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next"; import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core"; import { wrappable } from "@patternfly/react-table"; -import ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation"; +import type ClientInitialAccessPresentation from "keycloak-admin/lib/defs/clientInitialAccessPresentation"; import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable"; import { useAdminClient } from "../../context/auth/AdminClient"; import { useRealm } from "../../context/realm-context/RealmContext"; diff --git a/src/clients/keys/GenerateKeyDialog.tsx b/src/clients/keys/GenerateKeyDialog.tsx index cb8db7f2db..86782855d8 100644 --- a/src/clients/keys/GenerateKeyDialog.tsx +++ b/src/clients/keys/GenerateKeyDialog.tsx @@ -16,7 +16,7 @@ import { TextInput, } from "@patternfly/react-core"; -import KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig"; +import type KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { PasswordInput } from "../../components/password-input/PasswordInput"; import { StoreSettings } from "./StoreSettings"; diff --git a/src/clients/keys/Keys.tsx b/src/clients/keys/Keys.tsx index 9012cfaf2e..24659e405a 100644 --- a/src/clients/keys/Keys.tsx +++ b/src/clients/keys/Keys.tsx @@ -18,12 +18,12 @@ import { TextInput, } from "@patternfly/react-core"; -import CertificateRepresentation from "keycloak-admin/lib/defs/certificateRepresentation"; -import KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig"; +import type CertificateRepresentation from "keycloak-admin/lib/defs/certificateRepresentation"; +import type KeyStoreConfig from "keycloak-admin/lib/defs/keystoreConfig"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { FormAccess } from "../../components/form-access/FormAccess"; import { Controller, useFormContext, useWatch } from "react-hook-form"; -import { ClientForm } from "../ClientDetails"; +import type { ClientForm } from "../ClientDetails"; import { GenerateKeyDialog } from "./GenerateKeyDialog"; import { useFetch, useAdminClient } from "../../context/auth/AdminClient"; import { useAlerts } from "../../components/alert/Alerts"; diff --git a/src/clients/scopes/AddScopeDialog.tsx b/src/clients/scopes/AddScopeDialog.tsx index 9f9c602e92..3a75598802 100644 --- a/src/clients/scopes/AddScopeDialog.tsx +++ b/src/clients/scopes/AddScopeDialog.tsx @@ -10,7 +10,7 @@ import { DropdownDirection, } from "@patternfly/react-core"; import { CaretUpIcon } from "@patternfly/react-icons"; -import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; +import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; import { ClientScopeType, diff --git a/src/clients/scopes/ClientScopes.tsx b/src/clients/scopes/ClientScopes.tsx index 15b777a7cd..128cfa6c74 100644 --- a/src/clients/scopes/ClientScopes.tsx +++ b/src/clients/scopes/ClientScopes.tsx @@ -11,8 +11,8 @@ import { ToolbarItem, } from "@patternfly/react-core"; import { FilterIcon } from "@patternfly/react-icons"; -import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; -import KeycloakAdminClient from "keycloak-admin"; +import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; +import type KeycloakAdminClient from "keycloak-admin"; import { useAdminClient } from "../../context/auth/AdminClient"; import { toUpperCase } from "../../util"; diff --git a/src/clients/scopes/EvaluateScopes.tsx b/src/clients/scopes/EvaluateScopes.tsx index 82a059eab7..192195c155 100644 --- a/src/clients/scopes/EvaluateScopes.tsx +++ b/src/clients/scopes/EvaluateScopes.tsx @@ -24,11 +24,11 @@ import { Title, } from "@patternfly/react-core"; import { QuestionCircleIcon } from "@patternfly/react-icons"; -import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; -import ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; -import { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; +import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type ProtocolMapperRepresentation from "keycloak-admin/lib/defs/protocolMapperRepresentation"; +import type { ProtocolMapperTypeRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import { useAdminClient, useFetch } from "../../context/auth/AdminClient"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; diff --git a/src/clients/service-account/ServiceAccount.tsx b/src/clients/service-account/ServiceAccount.tsx index 6458ec4f3d..616d94f100 100644 --- a/src/clients/service-account/ServiceAccount.tsx +++ b/src/clients/service-account/ServiceAccount.tsx @@ -2,9 +2,8 @@ import React, { useContext, useState } from "react"; import { useTranslation } from "react-i18next"; import { AlertVariant } from "@patternfly/react-core"; -import RoleRepresentation, { - RoleMappingPayload, -} from "keycloak-admin/lib/defs/roleRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type { RoleMappingPayload } from "keycloak-admin/lib/defs/roleRepresentation"; import { useAdminClient } from "../../context/auth/AdminClient"; import { RealmContext } from "../../context/realm-context/RealmContext"; import { useAlerts } from "../../components/alert/Alerts"; diff --git a/src/components/attribute-form/AttributeForm.tsx b/src/components/attribute-form/AttributeForm.tsx index 06a71f1481..ac421cda5d 100644 --- a/src/components/attribute-form/AttributeForm.tsx +++ b/src/components/attribute-form/AttributeForm.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; -import { ArrayField, UseFormMethods } from "react-hook-form"; +import type { ArrayField, UseFormMethods } from "react-hook-form"; import { ActionGroup, Button, TextInput } from "@patternfly/react-core"; import { TableComposable, diff --git a/src/components/client-scope/ClientScopeTypes.tsx b/src/components/client-scope/ClientScopeTypes.tsx index 6dc2323199..fe5ff095bf 100644 --- a/src/components/client-scope/ClientScopeTypes.tsx +++ b/src/components/client-scope/ClientScopeTypes.tsx @@ -1,10 +1,10 @@ import React, { useState } from "react"; -import { TFunction } from "i18next"; +import type { TFunction } from "i18next"; import { useTranslation } from "react-i18next"; import { DropdownItem, Select, SelectOption } from "@patternfly/react-core"; -import ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; +import type ClientScopeRepresentation from "keycloak-admin/lib/defs/clientScopeRepresentation"; export enum ClientScope { default = "default", diff --git a/src/components/error/ErrorRenderer.tsx b/src/components/error/ErrorRenderer.tsx index 04751f02c5..5d67848039 100644 --- a/src/components/error/ErrorRenderer.tsx +++ b/src/components/error/ErrorRenderer.tsx @@ -6,7 +6,7 @@ import { PageSection, } from "@patternfly/react-core"; import React from "react"; -import { FallbackProps } from "react-error-boundary"; +import type { FallbackProps } from "react-error-boundary"; import { useTranslation } from "react-i18next"; export const ErrorRenderer = ({ error, resetErrorBoundary }: FallbackProps) => { diff --git a/src/components/external-link/FormattedLink.tsx b/src/components/external-link/FormattedLink.tsx index ff584b594d..2e2b146808 100644 --- a/src/components/external-link/FormattedLink.tsx +++ b/src/components/external-link/FormattedLink.tsx @@ -1,6 +1,6 @@ import React, { AnchorHTMLAttributes } from "react"; import { ExternalLinkAltIcon } from "@patternfly/react-icons"; -import { IFormatter, IFormatterValueType } from "@patternfly/react-table"; +import type { IFormatter, IFormatterValueType } from "@patternfly/react-table"; export type FormattedLinkProps = AnchorHTMLAttributes & { isInline?: boolean; diff --git a/src/components/form-access/FormAccess.tsx b/src/components/form-access/FormAccess.tsx index 3c44752d2f..aa27466038 100644 --- a/src/components/form-access/FormAccess.tsx +++ b/src/components/form-access/FormAccess.tsx @@ -18,7 +18,7 @@ import { StackItem, TextArea, } from "@patternfly/react-core"; -import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; +import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; import { useAccess } from "../../context/access/Access"; diff --git a/src/components/form-access/__tests__/FormAccess.test.tsx b/src/components/form-access/__tests__/FormAccess.test.tsx index 61e2f128aa..b5ea35bdfe 100644 --- a/src/components/form-access/__tests__/FormAccess.test.tsx +++ b/src/components/form-access/__tests__/FormAccess.test.tsx @@ -2,6 +2,7 @@ import React from "react"; import { mount } from "enzyme"; import { Controller, useForm } from "react-hook-form"; import { FormGroup, Switch, TextInput } from "@patternfly/react-core"; +import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation"; import { WhoAmI, WhoAmIContext } from "../../../context/whoami/WhoAmI"; import whoami from "../../../context/whoami/__tests__/mock-whoami.json"; @@ -15,7 +16,10 @@ describe("", () => { const { register, control } = useForm(); return ( {}, whoAmI: new WhoAmI("master", whoami) }} + value={{ + refresh: () => {}, + whoAmI: new WhoAmI("master", whoami as WhoAmIRepresentation), + }} > = keyof T | JSX.Element | TitleCell; diff --git a/src/context/access/Access.tsx b/src/context/access/Access.tsx index 42108f9d79..94d98bd3fa 100644 --- a/src/context/access/Access.tsx +++ b/src/context/access/Access.tsx @@ -1,5 +1,5 @@ import React, { createContext, useContext, useEffect, useState } from "react"; -import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; +import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; import { RealmContext } from "../../context/realm-context/RealmContext"; import { WhoAmIContext } from "../../context/whoami/WhoAmI"; diff --git a/src/context/auth/AdminClient.tsx b/src/context/auth/AdminClient.tsx index af6a1a58c1..6136ab8623 100644 --- a/src/context/auth/AdminClient.tsx +++ b/src/context/auth/AdminClient.tsx @@ -1,7 +1,7 @@ import { createContext, DependencyList, useContext, useEffect } from "react"; import axios from "axios"; -import KeycloakAdminClient from "keycloak-admin"; +import type KeycloakAdminClient from "keycloak-admin"; import { useErrorHandler } from "react-error-boundary"; export const AdminClient = createContext( diff --git a/src/context/realm-context/RealmContext.tsx b/src/context/realm-context/RealmContext.tsx index ebc259b821..d5a706dce5 100644 --- a/src/context/realm-context/RealmContext.tsx +++ b/src/context/realm-context/RealmContext.tsx @@ -1,7 +1,7 @@ import React, { useContext, useState } from "react"; import _ from "lodash"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { RecentUsed } from "../../components/realm-selector/recent-used"; import { useAdminClient, useFetch } from "../auth/AdminClient"; import { WhoAmIContext } from "../whoami/WhoAmI"; diff --git a/src/context/server-info/ServerInfoProvider.tsx b/src/context/server-info/ServerInfoProvider.tsx index 0e3bd691d1..7841d0b385 100644 --- a/src/context/server-info/ServerInfoProvider.tsx +++ b/src/context/server-info/ServerInfoProvider.tsx @@ -1,5 +1,5 @@ import React, { createContext, ReactNode, useContext } from "react"; -import { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; +import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import { sortProviders } from "../../util"; import { DataLoader } from "../../components/data-loader/DataLoader"; diff --git a/src/context/whoami/WhoAmI.tsx b/src/context/whoami/WhoAmI.tsx index f5ed990025..d174175bcc 100644 --- a/src/context/whoami/WhoAmI.tsx +++ b/src/context/whoami/WhoAmI.tsx @@ -1,9 +1,8 @@ import React, { useState } from "react"; import i18n from "../../i18n"; -import WhoAmIRepresentation, { - AccessType, -} from "keycloak-admin/lib/defs/whoAmIRepresentation"; +import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation"; +import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; import { useAdminClient, useFetch } from "../auth/AdminClient"; export class WhoAmI { diff --git a/src/context/whoami/__tests__/WhoAmI.test.tsx b/src/context/whoami/__tests__/WhoAmI.test.tsx index e1e9ff9ae2..47f3b38eda 100644 --- a/src/context/whoami/__tests__/WhoAmI.test.tsx +++ b/src/context/whoami/__tests__/WhoAmI.test.tsx @@ -1,25 +1,26 @@ import whoamiMock from "./mock-whoami.json"; import { WhoAmI } from "../WhoAmI"; +import type WhoAmIRepresentation from "keycloak-admin/lib/defs/whoAmIRepresentation"; test("returns display name", () => { - const whoami = new WhoAmI("master", whoamiMock); + const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation); expect(whoami.getDisplayName()).toEqual("Stan Silvert"); }); test("returns correct home realm", () => { - let whoami = new WhoAmI("myrealm", whoamiMock); + let whoami = new WhoAmI("myrealm", whoamiMock as WhoAmIRepresentation); expect(whoami.getHomeRealm()).toEqual("myrealm"); - whoami = new WhoAmI(undefined, whoamiMock); + whoami = new WhoAmI(undefined, whoamiMock as WhoAmIRepresentation); expect(whoami.getHomeRealm()).toEqual("master"); }); test("can not create realm", () => { - const whoami = new WhoAmI("master", whoamiMock); + const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation); expect(whoami.canCreateRealm()).toEqual(false); }); test("getRealmAccess", () => { - const whoami = new WhoAmI("master", whoamiMock); + const whoami = new WhoAmI("master", whoamiMock as WhoAmIRepresentation); expect(Object.keys(whoami.getRealmAccess()).length).toEqual(3); expect(whoami.getRealmAccess()["master"].length).toEqual(18); }); diff --git a/src/events/AdminEvents.tsx b/src/events/AdminEvents.tsx index 8474090fdb..b04af25df1 100644 --- a/src/events/AdminEvents.tsx +++ b/src/events/AdminEvents.tsx @@ -20,7 +20,7 @@ import { TableHeader, TableVariant, } from "@patternfly/react-table"; -import AdminEventRepresentation from "keycloak-admin/lib/defs/adminEventRepresentation"; +import type AdminEventRepresentation from "keycloak-admin/lib/defs/adminEventRepresentation"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; type DisplayDialogProps = { diff --git a/src/events/EventsSection.tsx b/src/events/EventsSection.tsx index 98797a8c59..66b7ea59c9 100644 --- a/src/events/EventsSection.tsx +++ b/src/events/EventsSection.tsx @@ -16,7 +16,7 @@ import { } from "@patternfly/react-core"; import { cellWidth, expandable } from "@patternfly/react-table"; import { CheckCircleIcon, WarningTriangleIcon } from "@patternfly/react-icons"; -import EventRepresentation from "keycloak-admin/lib/defs/eventRepresentation"; +import type EventRepresentation from "keycloak-admin/lib/defs/eventRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { ViewHeader } from "../components/view-header/ViewHeader"; diff --git a/src/groups/GroupTable.tsx b/src/groups/GroupTable.tsx index ee6191552f..2437e15cd8 100644 --- a/src/groups/GroupTable.tsx +++ b/src/groups/GroupTable.tsx @@ -12,7 +12,7 @@ import { } from "@patternfly/react-core"; import { UsersIcon } from "@patternfly/react-icons"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { useAlerts } from "../components/alert/Alerts"; import { useRealm } from "../context/realm-context/RealmContext"; diff --git a/src/groups/GroupsModal.tsx b/src/groups/GroupsModal.tsx index c7c02f4749..7255a55c01 100644 --- a/src/groups/GroupsModal.tsx +++ b/src/groups/GroupsModal.tsx @@ -13,7 +13,7 @@ import { import { useTranslation } from "react-i18next"; import { useForm } from "react-hook-form"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { useAlerts } from "../components/alert/Alerts"; diff --git a/src/groups/GroupsSection.tsx b/src/groups/GroupsSection.tsx index 17fff9e2be..2ecead6123 100644 --- a/src/groups/GroupsSection.tsx +++ b/src/groups/GroupsSection.tsx @@ -10,7 +10,7 @@ import { TabTitleText, Tabs, } from "@patternfly/react-core"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { ViewHeader } from "../components/view-header/ViewHeader"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; diff --git a/src/groups/Members.tsx b/src/groups/Members.tsx index 309a720abc..a864230fd1 100644 --- a/src/groups/Members.tsx +++ b/src/groups/Members.tsx @@ -12,8 +12,8 @@ import { ToolbarItem, } from "@patternfly/react-core"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAdminClient } from "../context/auth/AdminClient"; import { useAlerts } from "../components/alert/Alerts"; diff --git a/src/groups/MembersModal.tsx b/src/groups/MembersModal.tsx index 6d9f35539f..8f7c084043 100644 --- a/src/groups/MembersModal.tsx +++ b/src/groups/MembersModal.tsx @@ -8,7 +8,7 @@ import { ModalVariant, } from "@patternfly/react-core"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { useRealm } from "../context/realm-context/RealmContext"; import { useAlerts } from "../components/alert/Alerts"; diff --git a/src/groups/MoveGroupDialog.tsx b/src/groups/MoveGroupDialog.tsx index 2f54a1a9e3..f353ff0652 100644 --- a/src/groups/MoveGroupDialog.tsx +++ b/src/groups/MoveGroupDialog.tsx @@ -21,7 +21,7 @@ import { } from "@patternfly/react-core"; import { AngleRightIcon, SearchIcon } from "@patternfly/react-icons"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; diff --git a/src/groups/SearchGroups.tsx b/src/groups/SearchGroups.tsx index 2e6ccab42f..c20e33ee8d 100644 --- a/src/groups/SearchGroups.tsx +++ b/src/groups/SearchGroups.tsx @@ -16,7 +16,7 @@ import { } from "@patternfly/react-core"; import { SearchIcon } from "@patternfly/react-icons"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAdminClient } from "../context/auth/AdminClient"; import { useRealm } from "../context/realm-context/RealmContext"; diff --git a/src/groups/SubGroupsContext.tsx b/src/groups/SubGroupsContext.tsx index af0a54aace..50a567569e 100644 --- a/src/groups/SubGroupsContext.tsx +++ b/src/groups/SubGroupsContext.tsx @@ -1,5 +1,5 @@ import React, { createContext, ReactNode, useContext, useState } from "react"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; type SubGroupsProps = { subGroups: GroupRepresentation[]; diff --git a/src/identity-providers/IdentityProvidersSection.tsx b/src/identity-providers/IdentityProvidersSection.tsx index 5cbb508d22..49126a4ee2 100644 --- a/src/identity-providers/IdentityProvidersSection.tsx +++ b/src/identity-providers/IdentityProvidersSection.tsx @@ -23,7 +23,7 @@ import { ToolbarItem, } from "@patternfly/react-core"; -import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; +import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; import { ViewHeader } from "../components/view-header/ViewHeader"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; diff --git a/src/identity-providers/ManageOrderDialog.tsx b/src/identity-providers/ManageOrderDialog.tsx index b664cba882..afdaa4c10c 100644 --- a/src/identity-providers/ManageOrderDialog.tsx +++ b/src/identity-providers/ManageOrderDialog.tsx @@ -17,7 +17,7 @@ import { TextContent, Text, } from "@patternfly/react-core"; -import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; +import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; import { useAdminClient } from "../context/auth/AdminClient"; import { useAlerts } from "../components/alert/Alerts"; diff --git a/src/identity-providers/ProviderIconMapper.tsx b/src/identity-providers/ProviderIconMapper.tsx index 1d879c67f2..52a1ba317c 100644 --- a/src/identity-providers/ProviderIconMapper.tsx +++ b/src/identity-providers/ProviderIconMapper.tsx @@ -10,7 +10,7 @@ import { StackOverflowIcon, TwitterIcon, } from "@patternfly/react-icons"; -import { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon"; +import type { SVGIconProps } from "@patternfly/react-icons/dist/js/createIcon"; import { FontAwesomeIcon } from "./icons/FontAwesomeIcon"; diff --git a/src/identity-providers/add/AddIdentityProvider.tsx b/src/identity-providers/add/AddIdentityProvider.tsx index 7b707709db..d3275a386c 100644 --- a/src/identity-providers/add/AddIdentityProvider.tsx +++ b/src/identity-providers/add/AddIdentityProvider.tsx @@ -9,7 +9,7 @@ import { PageSection, } from "@patternfly/react-core"; -import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; +import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; import { ViewHeader } from "../../components/view-header/ViewHeader"; import { toUpperCase } from "../../util"; import { FormAccess } from "../../components/form-access/FormAccess"; diff --git a/src/identity-providers/add/AddOpenIdConnect.tsx b/src/identity-providers/add/AddOpenIdConnect.tsx index 82be3f1885..597746dd69 100644 --- a/src/identity-providers/add/AddOpenIdConnect.tsx +++ b/src/identity-providers/add/AddOpenIdConnect.tsx @@ -9,7 +9,7 @@ import { PageSection, } from "@patternfly/react-core"; -import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; +import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; import { FormAccess } from "../../components/form-access/FormAccess"; import { ViewHeader } from "../../components/view-header/ViewHeader"; import { useAdminClient } from "../../context/auth/AdminClient"; diff --git a/src/identity-providers/add/AdvancedSettings.tsx b/src/identity-providers/add/AdvancedSettings.tsx index db114c4ee5..c642d14e2d 100644 --- a/src/identity-providers/add/AdvancedSettings.tsx +++ b/src/identity-providers/add/AdvancedSettings.tsx @@ -10,12 +10,12 @@ import { SelectVariant, } from "@patternfly/react-core"; -import AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation"; +import type AuthenticationFlowRepresentation from "keycloak-admin/lib/defs/authenticationFlowRepresentation"; import { useFetch, useAdminClient } from "../../context/auth/AdminClient"; import { SwitchField } from "../component/SwitchField"; import { TextField } from "../component/TextField"; import { HelpItem } from "../../components/help-enabler/HelpItem"; -import { FieldProps } from "../component/FormGroupField"; +import type { FieldProps } from "../component/FormGroupField"; const LoginFlow = ({ field, diff --git a/src/identity-providers/add/DetailSettings.tsx b/src/identity-providers/add/DetailSettings.tsx index 95295777f1..33d5afc7b0 100644 --- a/src/identity-providers/add/DetailSettings.tsx +++ b/src/identity-providers/add/DetailSettings.tsx @@ -13,7 +13,7 @@ import { TabTitleText, } from "@patternfly/react-core"; -import IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; +import type IdentityProviderRepresentation from "keycloak-admin/lib/defs/identityProviderRepresentation"; import { FormAccess } from "../../components/form-access/FormAccess"; import { ScrollForm } from "../../components/scroll-form/ScrollForm"; import { ViewHeader } from "../../components/view-header/ViewHeader"; diff --git a/src/identity-providers/add/OpenIdConnectSettings.tsx b/src/identity-providers/add/OpenIdConnectSettings.tsx index 240c4cdeb1..e06ea5050c 100644 --- a/src/identity-providers/add/OpenIdConnectSettings.tsx +++ b/src/identity-providers/add/OpenIdConnectSettings.tsx @@ -5,7 +5,7 @@ import { FormGroup, Switch, TextInput, Title } from "@patternfly/react-core"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { useTranslation } from "react-i18next"; import { useAdminClient } from "../../context/auth/AdminClient"; -import { OIDCConfigurationRepresentation } from "../OIDCConfigurationRepresentation"; +import type { OIDCConfigurationRepresentation } from "../OIDCConfigurationRepresentation"; import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload"; import { useRealm } from "../../context/realm-context/RealmContext"; import { DiscoverySettings } from "./DiscoverySettings"; diff --git a/src/realm-roles/AliasRendererComponent.tsx b/src/realm-roles/AliasRendererComponent.tsx index 3ca8e393c2..fce97a4539 100644 --- a/src/realm-roles/AliasRendererComponent.tsx +++ b/src/realm-roles/AliasRendererComponent.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import KeycloakAdminClient from "keycloak-admin"; +import type KeycloakAdminClient from "keycloak-admin"; import { Label } from "@patternfly/react-core"; export type AliasRendererComponentProps = { diff --git a/src/realm-roles/AssociatedRolesModal.tsx b/src/realm-roles/AssociatedRolesModal.tsx index e4d3da4e89..28ce1a4b54 100644 --- a/src/realm-roles/AssociatedRolesModal.tsx +++ b/src/realm-roles/AssociatedRolesModal.tsx @@ -11,7 +11,7 @@ import { } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { CaretDownIcon, FilterIcon } from "@patternfly/react-icons"; diff --git a/src/realm-roles/AssociatedRolesTab.tsx b/src/realm-roles/AssociatedRolesTab.tsx index b43b92e3c6..944ecdf648 100644 --- a/src/realm-roles/AssociatedRolesTab.tsx +++ b/src/realm-roles/AssociatedRolesTab.tsx @@ -10,7 +10,7 @@ import { PageSection, ToolbarItem, } from "@patternfly/react-core"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAlerts } from "../components/alert/Alerts"; @@ -18,8 +18,8 @@ import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { emptyFormatter } from "../util"; import { AssociatedRolesModal } from "./AssociatedRolesModal"; import { useAdminClient } from "../context/auth/AdminClient"; -import { RoleFormType } from "./RealmRoleTabs"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type { RoleFormType } from "./RealmRoleTabs"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; import _ from "lodash"; type AssociatedRolesTabProps = { diff --git a/src/realm-roles/RealmRoleForm.tsx b/src/realm-roles/RealmRoleForm.tsx index 501c141bfa..a6cecf51a4 100644 --- a/src/realm-roles/RealmRoleForm.tsx +++ b/src/realm-roles/RealmRoleForm.tsx @@ -8,8 +8,8 @@ import { ValidatedOptions, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import { UseFormMethods } from "react-hook-form"; -import { RoleFormType } from "./RealmRoleTabs"; +import type { UseFormMethods } from "react-hook-form"; +import type { RoleFormType } from "./RealmRoleTabs"; import { FormAccess } from "../components/form-access/FormAccess"; export type RealmRoleFormProps = { diff --git a/src/realm-roles/RealmRoleTabs.tsx b/src/realm-roles/RealmRoleTabs.tsx index 7e915eca09..24adf17ca0 100644 --- a/src/realm-roles/RealmRoleTabs.tsx +++ b/src/realm-roles/RealmRoleTabs.tsx @@ -13,8 +13,8 @@ import { useFieldArray, useForm } from "react-hook-form"; import { useAlerts } from "../components/alert/Alerts"; import { useAdminClient } from "../context/auth/AdminClient"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; -import Composites from "keycloak-admin/lib/defs/roleRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type Composites from "keycloak-admin/lib/defs/roleRepresentation"; import { KeyValueType, AttributesForm, diff --git a/src/realm-roles/RoleAttributes.tsx b/src/realm-roles/RoleAttributes.tsx index f967972a22..b82a1dc2eb 100644 --- a/src/realm-roles/RoleAttributes.tsx +++ b/src/realm-roles/RoleAttributes.tsx @@ -1,6 +1,6 @@ import React from "react"; import { useTranslation } from "react-i18next"; -import { ArrayField, UseFormMethods } from "react-hook-form"; +import type { ArrayField, UseFormMethods } from "react-hook-form"; import { ActionGroup, Button, TextInput } from "@patternfly/react-core"; import { TableComposable, @@ -13,7 +13,7 @@ import { import { MinusCircleIcon, PlusCircleIcon } from "@patternfly/react-icons"; import { FormAccess } from "../components/form-access/FormAccess"; -import { RoleFormType } from "./RealmRoleTabs"; +import type { RoleFormType } from "./RealmRoleTabs"; import "./RealmRolesSection.css"; diff --git a/src/realm-roles/RolesList.tsx b/src/realm-roles/RolesList.tsx index 8c047aef84..6fbfa3f92c 100644 --- a/src/realm-roles/RolesList.tsx +++ b/src/realm-roles/RolesList.tsx @@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next"; import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core"; import { useAdminClient } from "../context/auth/AdminClient"; -import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; +import type RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAlerts } from "../components/alert/Alerts"; diff --git a/src/realm-settings/EmailTab.tsx b/src/realm-settings/EmailTab.tsx index 42dada29cb..7f121792f6 100644 --- a/src/realm-settings/EmailTab.tsx +++ b/src/realm-settings/EmailTab.tsx @@ -11,7 +11,7 @@ import { TextInput, } from "@patternfly/react-core"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormPanel } from "../components/scroll-form/FormPanel"; diff --git a/src/realm-settings/GeneralTab.tsx b/src/realm-settings/GeneralTab.tsx index e0af4d1a9a..784487a053 100644 --- a/src/realm-settings/GeneralTab.tsx +++ b/src/realm-settings/GeneralTab.tsx @@ -16,7 +16,7 @@ import { TextInput, } from "@patternfly/react-core"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { getBaseUrl } from "../util"; import { useAdminClient } from "../context/auth/AdminClient"; import { useRealm } from "../context/realm-context/RealmContext"; diff --git a/src/realm-settings/KeysListTab.tsx b/src/realm-settings/KeysListTab.tsx index e4f3055135..766bdc59fd 100644 --- a/src/realm-settings/KeysListTab.tsx +++ b/src/realm-settings/KeysListTab.tsx @@ -2,12 +2,12 @@ import React, { useState } from "react"; import { useHistory, useRouteMatch } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Button, ButtonVariant, PageSection } from "@patternfly/react-core"; -import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; +import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { emptyFormatter } from "../util"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import "./RealmSettingsSection.css"; import { cellWidth } from "@patternfly/react-table"; diff --git a/src/realm-settings/KeysTab.tsx b/src/realm-settings/KeysTab.tsx index fe93ca417a..54e16c30f2 100644 --- a/src/realm-settings/KeysTab.tsx +++ b/src/realm-settings/KeysTab.tsx @@ -2,12 +2,12 @@ import React, { useState } from "react"; import { useHistory, useRouteMatch } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Button, ButtonVariant, PageSection } from "@patternfly/react-core"; -import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; +import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { emptyFormatter } from "../util"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import "./RealmSettingsSection.css"; import { cellWidth } from "@patternfly/react-table"; diff --git a/src/realm-settings/LoginTab.tsx b/src/realm-settings/LoginTab.tsx index 7329a5bf31..45b9c721f7 100644 --- a/src/realm-settings/LoginTab.tsx +++ b/src/realm-settings/LoginTab.tsx @@ -4,7 +4,7 @@ import { FormGroup, PageSection, Switch } from "@patternfly/react-core"; import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormPanel } from "../components/scroll-form/FormPanel"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; type RealmSettingsLoginTabProps = { save: (realm: RealmRepresentation) => void; diff --git a/src/realm-settings/RealmSettingsSection.tsx b/src/realm-settings/RealmSettingsSection.tsx index bdececb0ca..54b3dc188c 100644 --- a/src/realm-settings/RealmSettingsSection.tsx +++ b/src/realm-settings/RealmSettingsSection.tsx @@ -13,7 +13,7 @@ import { TabTitleText, } from "@patternfly/react-core"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { toUpperCase } from "../util"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useAdminClient, useFetch } from "../context/auth/AdminClient"; @@ -27,8 +27,8 @@ import { PartialImportDialog } from "./PartialImport"; import { RealmSettingsThemesTab } from "./ThemesTab"; import { RealmSettingsEmailTab } from "./EmailTab"; import { KeysListTab } from "./KeysListTab"; -import { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type { KeyMetadataRepresentation } from "keycloak-admin/lib/defs/keyMetadataRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; type RealmSettingsHeaderProps = { onChange: (value: boolean) => void; diff --git a/src/realm-settings/ThemesTab.tsx b/src/realm-settings/ThemesTab.tsx index 8dcf74c6d2..81a0e5809a 100644 --- a/src/realm-settings/ThemesTab.tsx +++ b/src/realm-settings/ThemesTab.tsx @@ -12,7 +12,7 @@ import { Switch, } from "@patternfly/react-core"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; diff --git a/src/realm/add/NewRealmForm.tsx b/src/realm/add/NewRealmForm.tsx index 7e6b94482a..f5834b96f4 100644 --- a/src/realm/add/NewRealmForm.tsx +++ b/src/realm/add/NewRealmForm.tsx @@ -15,7 +15,7 @@ import { JsonFileUpload } from "../../components/json-file-upload/JsonFileUpload import { useAlerts } from "../../components/alert/Alerts"; import { useForm, Controller } from "react-hook-form"; import { ViewHeader } from "../../components/view-header/ViewHeader"; -import RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; +import type RealmRepresentation from "keycloak-admin/lib/defs/realmRepresentation"; import { useAdminClient } from "../../context/auth/AdminClient"; import { WhoAmIContext } from "../../context/whoami/WhoAmI"; import { FormAccess } from "../../components/form-access/FormAccess"; diff --git a/src/route-config.ts b/src/route-config.ts index 6c4c94157e..aae1bd9d5a 100644 --- a/src/route-config.ts +++ b/src/route-config.ts @@ -1,6 +1,6 @@ -import { TFunction } from "i18next"; -import { BreadcrumbsRoute } from "use-react-router-breadcrumbs"; -import { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; +import type { TFunction } from "i18next"; +import type { BreadcrumbsRoute } from "use-react-router-breadcrumbs"; +import type { AccessType } from "keycloak-admin/lib/defs/whoAmIRepresentation"; import { AuthenticationSection } from "./authentication/AuthenticationSection"; import { ClientScopeForm } from "./client-scopes/form/ClientScopeForm"; diff --git a/src/sessions/SessionsSection.tsx b/src/sessions/SessionsSection.tsx index 749dabc54e..35314ed209 100644 --- a/src/sessions/SessionsSection.tsx +++ b/src/sessions/SessionsSection.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Link } from "react-router-dom"; import { PageSection } from "@patternfly/react-core"; import moment from "moment"; -import UserSessionRepresentation from "keycloak-admin/lib/defs/userSessionRepresentation"; +import type UserSessionRepresentation from "keycloak-admin/lib/defs/userSessionRepresentation"; import { ViewHeader } from "../components/view-header/ViewHeader"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; diff --git a/src/stories/AddMapperDialog.stories.tsx b/src/stories/AddMapperDialog.stories.tsx index 476bc5a95a..a3cba07efc 100644 --- a/src/stories/AddMapperDialog.stories.tsx +++ b/src/stories/AddMapperDialog.stories.tsx @@ -1,6 +1,7 @@ import React, { useState } from "react"; import { Button } from "@patternfly/react-core"; -import { Meta, Story } from "@storybook/react"; +import type { Meta, Story } from "@storybook/react"; +import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import serverInfo from "../context/server-info/__tests__/mock.json"; import { ServerInfoContext } from "../context/server-info/ServerInfoProvider"; @@ -17,7 +18,9 @@ export default { const Template: Story = (args) => { const [open, setOpen] = useState(false); return ( - + clients, + loader: async () => clients, }; export const LoadingList = Template.bind({}); diff --git a/src/stories/ListEmptyState.stories.tsx b/src/stories/ListEmptyState.stories.tsx index 884f8dca4a..05bb9da66b 100644 --- a/src/stories/ListEmptyState.stories.tsx +++ b/src/stories/ListEmptyState.stories.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Meta, Story } from "@storybook/react"; +import type { Meta, Story } from "@storybook/react"; import { ListEmptyState, ListEmptyStateProps, diff --git a/src/stories/MapperList.stories.tsx b/src/stories/MapperList.stories.tsx index 664d4e2ec9..4fa037f420 100644 --- a/src/stories/MapperList.stories.tsx +++ b/src/stories/MapperList.stories.tsx @@ -1,5 +1,6 @@ import React from "react"; -import { Meta } from "@storybook/react"; +import type { Meta } from "@storybook/react"; +import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import serverInfo from "../context/server-info/__tests__/mock.json"; import clientScopeMock from "../client-scopes/__tests__/mock-client-scope.json"; @@ -13,7 +14,9 @@ export default { } as Meta; export const MapperListExample = () => ( - + {}} /> diff --git a/src/stories/MockAdminClient.tsx b/src/stories/MockAdminClient.tsx index 01bb498b32..8a3d85e64e 100644 --- a/src/stories/MockAdminClient.tsx +++ b/src/stories/MockAdminClient.tsx @@ -1,6 +1,7 @@ import React, { ReactNode } from "react"; import { HashRouter } from "react-router-dom"; -import KeycloakAdminClient from "keycloak-admin"; +import type KeycloakAdminClient from "keycloak-admin"; +import type { ServerInfoRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; import { AccessContextProvider } from "../context/access/Access"; import { WhoAmIContextProvider } from "../context/whoami/WhoAmI"; @@ -30,7 +31,9 @@ export const MockAdminClient = (props: { }) => { return ( - + ( - + { diff --git a/src/user-federation/UserFederationLdapSettings.tsx b/src/user-federation/UserFederationLdapSettings.tsx index 54ee85a7d4..13cffe17c5 100644 --- a/src/user-federation/UserFederationLdapSettings.tsx +++ b/src/user-federation/UserFederationLdapSettings.tsx @@ -22,7 +22,7 @@ import { LdapSettingsSearching } from "./ldap/LdapSettingsSearching"; import { useRealm } from "../context/realm-context/RealmContext"; import { convertToFormValues } from "../util"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { Controller, useForm } from "react-hook-form"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; diff --git a/src/user-federation/UserFederationLdapWizard.tsx b/src/user-federation/UserFederationLdapWizard.tsx index 7efce76e04..6d0b51b116 100644 --- a/src/user-federation/UserFederationLdapWizard.tsx +++ b/src/user-federation/UserFederationLdapWizard.tsx @@ -13,7 +13,7 @@ import { LdapSettingsKerberosIntegration } from "./ldap/LdapSettingsKerberosInte import { SettingsCache } from "./shared/SettingsCache"; import { LdapSettingsAdvanced } from "./ldap/LdapSettingsAdvanced"; import { useTranslation } from "react-i18next"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { useForm } from "react-hook-form"; diff --git a/src/user-federation/UserFederationSection.tsx b/src/user-federation/UserFederationSection.tsx index c1679fd439..cb0605f6d9 100644 --- a/src/user-federation/UserFederationSection.tsx +++ b/src/user-federation/UserFederationSection.tsx @@ -16,7 +16,7 @@ import { TextVariants, } from "@patternfly/react-core"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { KeycloakCard } from "../components/keycloak-card/KeycloakCard"; import { useAlerts } from "../components/alert/Alerts"; import { ViewHeader } from "../components/view-header/ViewHeader"; diff --git a/src/user-federation/ldap/LdapSettingsConnection.tsx b/src/user-federation/ldap/LdapSettingsConnection.tsx index c2a0cc7518..6208aafca8 100644 --- a/src/user-federation/ldap/LdapSettingsConnection.tsx +++ b/src/user-federation/ldap/LdapSettingsConnection.tsx @@ -13,7 +13,7 @@ import { useTranslation } from "react-i18next"; import React, { useState } from "react"; import _ from "lodash"; -import TestLdapConnectionRepresentation from "keycloak-admin/lib/defs/testLdapConnection"; +import type TestLdapConnectionRepresentation from "keycloak-admin/lib/defs/testLdapConnection"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { Controller, UseFormMethods, useWatch } from "react-hook-form"; import { FormAccess } from "../../components/form-access/FormAccess"; diff --git a/src/user-federation/ldap/mappers/LdapMapperDetails.tsx b/src/user-federation/ldap/mappers/LdapMapperDetails.tsx index 1e21167d36..0d256e111d 100644 --- a/src/user-federation/ldap/mappers/LdapMapperDetails.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperDetails.tsx @@ -12,7 +12,7 @@ import { TextInput, } from "@patternfly/react-core"; import { convertFormValuesToObject, convertToFormValues } from "../../../util"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { useAdminClient } from "../../../context/auth/AdminClient"; import { ViewHeader } from "../../../components/view-header/ViewHeader"; import { useHistory, useParams } from "react-router-dom"; diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedAttribute.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedAttribute.tsx index 775e898fe5..e6af1f6d98 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedAttribute.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedAttribute.tsx @@ -1,7 +1,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core"; import React from "react"; import { HelpItem } from "../../../components/help-enabler/HelpItem"; -import { UseFormMethods } from "react-hook-form"; +import type { UseFormMethods } from "react-hook-form"; import { useTranslation } from "react-i18next"; export type LdapMapperHardcodedAttributeProps = { diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx index 416d5e088d..7804266081 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapAttribute.tsx @@ -1,7 +1,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core"; import React from "react"; import { HelpItem } from "../../../components/help-enabler/HelpItem"; -import { UseFormMethods } from "react-hook-form"; +import type { UseFormMethods } from "react-hook-form"; import { useTranslation } from "react-i18next"; export type LdapMapperHardcodedLdapAttributeProps = { diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx index a1e6b5dbc0..9c1af99aa8 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapGroup.tsx @@ -1,7 +1,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core"; import React from "react"; import { HelpItem } from "../../../components/help-enabler/HelpItem"; -import { UseFormMethods } from "react-hook-form"; +import type { UseFormMethods } from "react-hook-form"; import { useTranslation } from "react-i18next"; export type LdapMapperHardcodedLdapGroupProps = { diff --git a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx index 01e28df32b..3b8e00ce83 100644 --- a/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperHardcodedLdapRole.tsx @@ -1,7 +1,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core"; import React from "react"; import { HelpItem } from "../../../components/help-enabler/HelpItem"; -import { UseFormMethods } from "react-hook-form"; +import type { UseFormMethods } from "react-hook-form"; import { useTranslation } from "react-i18next"; export type LdapMapperHardcodedLdapRoleProps = { diff --git a/src/user-federation/ldap/mappers/LdapMapperList.tsx b/src/user-federation/ldap/mappers/LdapMapperList.tsx index 3370610ac4..424aaa87bb 100644 --- a/src/user-federation/ldap/mappers/LdapMapperList.tsx +++ b/src/user-federation/ldap/mappers/LdapMapperList.tsx @@ -8,7 +8,7 @@ import { ToolbarItem, } from "@patternfly/react-core"; -import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; +import type ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { KeycloakDataTable } from "../../../components/table-toolbar/KeycloakDataTable"; import { ListEmptyState } from "../../../components/list-empty-state/ListEmptyState"; import { useAlerts } from "../../../components/alert/Alerts"; diff --git a/src/user/JoinGroupDialog.tsx b/src/user/JoinGroupDialog.tsx index 5bab44da09..6e47fe8962 100644 --- a/src/user/JoinGroupDialog.tsx +++ b/src/user/JoinGroupDialog.tsx @@ -22,7 +22,7 @@ import { import { useTranslation } from "react-i18next"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; import { AngleRightIcon, SearchIcon } from "@patternfly/react-icons"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import _ from "lodash"; import { useParams } from "react-router-dom"; diff --git a/src/user/UserConsents.tsx b/src/user/UserConsents.tsx index 7a0d15172b..c2eb778562 100644 --- a/src/user/UserConsents.tsx +++ b/src/user/UserConsents.tsx @@ -8,7 +8,7 @@ import { emptyFormatter } from "../util"; import { useAdminClient } from "../context/auth/AdminClient"; import { cellWidth } from "@patternfly/react-table"; import _ from "lodash"; -import UserConsentRepresentation from "keycloak-admin/lib/defs/userConsentRepresentation"; +import type UserConsentRepresentation from "keycloak-admin/lib/defs/userConsentRepresentation"; import { CubesIcon } from "@patternfly/react-icons"; import moment from "moment"; diff --git a/src/user/UserForm.tsx b/src/user/UserForm.tsx index 9df881f247..5c421c6ddc 100644 --- a/src/user/UserForm.tsx +++ b/src/user/UserForm.tsx @@ -16,13 +16,13 @@ import { useTranslation } from "react-i18next"; import { Controller, UseFormMethods } from "react-hook-form"; import { useHistory, useParams } from "react-router-dom"; import { FormAccess } from "../components/form-access/FormAccess"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { useRealm } from "../context/realm-context/RealmContext"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; import moment from "moment"; import { JoinGroupDialog } from "./JoinGroupDialog"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { useAlerts } from "../components/alert/Alerts"; import { emailRegexPattern } from "../util"; diff --git a/src/user/UserGroups.tsx b/src/user/UserGroups.tsx index 3f7d38b371..b7570dd739 100644 --- a/src/user/UserGroups.tsx +++ b/src/user/UserGroups.tsx @@ -15,10 +15,10 @@ import { useAlerts } from "../components/alert/Alerts"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { emptyFormatter } from "../util"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; import { cellWidth } from "@patternfly/react-table"; import _ from "lodash"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { JoinGroupDialog } from "./JoinGroupDialog"; import { HelpContext } from "../components/help-enabler/HelpHeader"; import { QuestionCircleIcon } from "@patternfly/react-icons"; diff --git a/src/user/UsersSection.tsx b/src/user/UsersSection.tsx index 3d8b233d84..b926caf42e 100644 --- a/src/user/UsersSection.tsx +++ b/src/user/UsersSection.tsx @@ -14,7 +14,7 @@ import { InfoCircleIcon, WarningTriangleIcon, } from "@patternfly/react-icons"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { useFetch, useAdminClient } from "../context/auth/AdminClient"; import { ViewHeader } from "../components/view-header/ViewHeader"; diff --git a/src/user/UsersTabs.tsx b/src/user/UsersTabs.tsx index 33f0b87410..f489e7805e 100644 --- a/src/user/UsersTabs.tsx +++ b/src/user/UsersTabs.tsx @@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next"; import { useForm } from "react-hook-form"; import { ViewHeader } from "../components/view-header/ViewHeader"; -import UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; +import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation"; import { UserForm } from "./UserForm"; import { useAlerts } from "../components/alert/Alerts"; import { useAdminClient } from "../context/auth/AdminClient"; @@ -17,7 +17,7 @@ import { useHistory, useParams, useRouteMatch } from "react-router-dom"; import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs"; import { UserGroups } from "./UserGroups"; import { UserConsents } from "./UserConsents"; -import GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; +import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation"; export const UsersTabs = () => { const { t } = useTranslation("roles"); diff --git a/src/util.ts b/src/util.ts index 60ccf160cb..73723e3417 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,9 +1,9 @@ -import { IFormatter, IFormatterValueType } from "@patternfly/react-table"; +import type { IFormatter, IFormatterValueType } from "@patternfly/react-table"; import FileSaver from "file-saver"; import _ from "lodash"; -import ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; -import { ProviderRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; -import KeycloakAdminClient from "keycloak-admin"; +import type ClientRepresentation from "keycloak-admin/lib/defs/clientRepresentation"; +import type { ProviderRepresentation } from "keycloak-admin/lib/defs/serverInfoRepesentation"; +import type KeycloakAdminClient from "keycloak-admin"; export const sortProviders = (providers: { [index: string]: ProviderRepresentation; diff --git a/tsconfig.json b/tsconfig.json index e9801e8ae5..885daf5a06 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,64 +1,7 @@ { + "extends": "@snowpack/app-scripts-react/tsconfig.base.json", "compilerOptions": { - /* Basic Options */ - "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "lib", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "removeComments": true, /* Do not emit comments to output. */ - "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - // "declarationDir": "lib" /* Output directory for generated declaration files. */ - "skipLibCheck": true, - "types": ["jest", "cypress"] + "types": ["jest", "cypress"], + "esModuleInterop": true } } \ No newline at end of file diff --git a/types/import.d.ts b/types/import.d.ts index 61c86fae5d..ac4223acec 100644 --- a/types/import.d.ts +++ b/types/import.d.ts @@ -1,12 +1,3 @@ -// ESM-HMR Interface: `import.meta.hot` - -interface ImportMeta { - // TODO: Import the exact .d.ts files from "esm-hmr" - // https://github.com/pikapkg/esm-hmr - hot: any; - env: Record; -} - declare namespace Cypress { interface Chainable { /**