Skip to content

Commit f6e6b61

Browse files
committed
fix(build): resolve all TypeScript build errors in frontend
## Changes - Add vite/client reference to env.vars.ts for import.meta.env types - Add SVG declarations.d.ts reference to vite-env.d.ts for ReactComponent exports - Add vite-env.d.ts references in store.ts and deploymentHelpers.ts for __APP_VERSION__ - Fix test mock types to match updated auth slice (isSuperAdmin, activeOrganizationId) - Fix createElement calls in test files to pass children in props object - Remove unused imports in test files (fireEvent, within) - Fix Field test to use document.querySelector instead of non-existent queryByClassName - Prefix unused variable in Dashboard (superAdminHasNoOrgs -> _superAdminHasNoOrgs) - Fix test/setup.ts type cast - Remove stale Event.js file ## Result Both `cd Servers && npm run build` and `cd Clients && npm run build` pass with zero errors.
1 parent f8b421d commit f6e6b61

File tree

14 files changed

+24
-17
lines changed

14 files changed

+24
-17
lines changed

Clients/env.vars.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference types="vite/client" />
2+
13
export const ENV_VARs = {
24
URL:
35
import.meta.env.VITE_APP_API_BASE_URL ?? // keep empty string if set

Clients/src/application/hooks/__tests__/useAuth.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ function createWrapper(authToken: string) {
3232
expirationDate: null,
3333
onboardingStatus: "completed",
3434
isOrgCreator: false,
35+
isSuperAdmin: false,
36+
activeOrganizationId: null,
3537
},
3638
},
3739
});
3840

3941
return ({ children }: { children: React.ReactNode }) =>
40-
React.createElement(Provider, { store }, children);
42+
React.createElement(Provider, { store, children });
4143
}
4244

4345
describe("useAuth", () => {

Clients/src/application/hooks/__tests__/useIsAdmin.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ function createWrapper(authToken: string) {
2727
expirationDate: null,
2828
onboardingStatus: "completed",
2929
isOrgCreator: false,
30+
isSuperAdmin: false,
31+
activeOrganizationId: null,
3032
},
3133
},
3234
});
3335

3436
return ({ children }: { children: React.ReactNode }) =>
35-
React.createElement(Provider, { store }, children);
37+
React.createElement(Provider, { store, children });
3638
}
3739

3840
describe("useIsAdmin", () => {

Clients/src/application/hooks/__tests__/useLogout.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ function createWrapper() {
2929
expirationDate: Date.now() + 3600000,
3030
onboardingStatus: "completed",
3131
isOrgCreator: false,
32+
isSuperAdmin: false,
33+
activeOrganizationId: null,
3234
},
3335
},
3436
});
3537

36-
const Wrapper = ({ children }: { children: React.ReactNode }) =>
37-
React.createElement(
38-
Provider,
39-
{ store },
40-
React.createElement(MemoryRouter, null, children)
41-
);
38+
const Wrapper = ({ children }: { children: React.ReactNode }) => {
39+
const inner = React.createElement(MemoryRouter, null, children);
40+
return React.createElement(Provider, { store, children: inner });
41+
};
4242

4343
return { Wrapper, store };
4444
}

Clients/src/application/redux/store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference path="../../vite-env.d.ts" />
12
import { combineReducers, configureStore } from "@reduxjs/toolkit";
23
import { persistReducer, persistStore } from "redux-persist";
34
import storage from "redux-persist/es/storage";

Clients/src/application/redux/ui/__tests__/uiSlice.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("uiSlice", () => {
6464
const state = uiReducer(
6565
stateWithTable,
6666
setRowsPerPage({ table: "vendors", value: 25 })
67-
);
67+
) as any;
6868
expect(state.vendors.rowsPerPage).toBe(25);
6969
});
7070

Clients/src/application/utils/deploymentHelpers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference path="../../vite-env.d.ts" />
12
import React from "react";
23
import { ENV_VARs } from "../../../env.vars";
34

Clients/src/domain/types/Event.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

Clients/src/presentation/components/CommandPalette/__tests__/CommandPalette.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { screen, fireEvent } from "@testing-library/react";
1+
import { screen } from "@testing-library/react";
22
import { renderWithProviders } from "../../../../test/renderWithProviders";
33
import { CommandPalette } from "../index";
44

Clients/src/presentation/components/Inputs/Field/__tests__/Field.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe("Field Component", () => {
103103
it("does not display error when error prop is empty", () => {
104104
renderWithProviders(<Field label="Email" />);
105105

106-
expect(screen.queryByClassName?.("input-error")).not.toBeTruthy();
106+
expect(document.querySelector(".input-error")).not.toBeTruthy();
107107
});
108108

109109
it("renders disabled input", () => {

0 commit comments

Comments
 (0)