Skip to content

Commit

Permalink
Update code to remove all use of any for types (resolves @typescript-…
Browse files Browse the repository at this point in the history
…eslint/no-explicit-any warnings)
  • Loading branch information
courtneymyers committed Oct 10, 2023
1 parent 0977175 commit 3448630
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
11 changes: 6 additions & 5 deletions app/client/src/components/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RebateYearProvider } from "@/contexts/rebateYear";

declare global {
interface Window {
csb: any;
csb?: { toggleReactQueryDevtools: () => void };
}
}

Expand All @@ -22,11 +22,12 @@ export function Providers(props: { children: ReactNode }) {
const { children } = props;

const [queryClient] = useState(() => new QueryClient());
const [devtoolsDisplayed, setDevtoolsDisplayed] = useState(false);
const [reactQueryDevtoolsShown, setReactQueryDevtoolsShown] = useState(false);

useEffect(() => {
window.csb ??= {};
window.csb.toggleDevtools = () => setDevtoolsDisplayed((value) => !value);
window.csb ??= {
toggleReactQueryDevtools: () => setReactQueryDevtoolsShown((val) => !val),
};
});

return (
Expand All @@ -37,7 +38,7 @@ export function Providers(props: { children: ReactNode }) {
</NotificationsProvider>
</DialogProvider>

{devtoolsDisplayed && (
{reactQueryDevtoolsShown && (
<Suspense fallback={null}>
<ReactQueryDevtoolsProduction />
</Suspense>
Expand Down
5 changes: 4 additions & 1 deletion app/client/src/routes/crf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) {
* https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5
* https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90
*/
Formio.Providers.providers.storage.s3 = function (formio: any) {
Formio.Providers.providers.storage.s3 = function (formio: {
formUrl: string;
[field: string]: unknown;
}) {
const s3Formio = cloneDeep(formio);
s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/crf/${mongoId}/${comboKey}`;
return s3(s3Formio);
Expand Down
5 changes: 4 additions & 1 deletion app/client/src/routes/frf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) {
* https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5
* https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90
*/
Formio.Providers.providers.storage.s3 = function (formio: any) {
Formio.Providers.providers.storage.s3 = function (formio: {
formUrl: string;
[field: string]: unknown;
}) {
const s3Formio = cloneDeep(formio);
s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/frf/${mongoId}/${comboKey}`;
return s3(s3Formio);
Expand Down
5 changes: 4 additions & 1 deletion app/client/src/routes/frf2023.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) {
* https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5
* https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90
*/
Formio.Providers.providers.storage.s3 = function (formio: any) {
Formio.Providers.providers.storage.s3 = function (formio: {
formUrl: string;
[field: string]: unknown;
}) {
const s3Formio = cloneDeep(formio);
s3Formio.formUrl = `${serverUrl}/api/formio/2023/s3/frf/${mongoId}/${comboKey}`;
return s3(s3Formio);
Expand Down
5 changes: 4 additions & 1 deletion app/client/src/routes/prf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) {
* https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5
* https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90
*/
Formio.Providers.providers.storage.s3 = function (formio: any) {
Formio.Providers.providers.storage.s3 = function (formio: {
formUrl: string;
[field: string]: unknown;
}) {
const s3Formio = cloneDeep(formio);
s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/prf/${mongoId}/${comboKey}`;
return s3(s3Formio);
Expand Down
6 changes: 3 additions & 3 deletions app/client/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export type Rebate =
};
};

async function fetchData<T = any>(url: string, options: RequestInit) {
async function fetchData<T = unknown>(url: string, options: RequestInit) {
try {
const response = await fetch(url, options);
const contentType = response.headers.get("content-type");
Expand All @@ -253,7 +253,7 @@ async function fetchData<T = any>(url: string, options: RequestInit) {
* Fetches data and returns a promise containing JSON fetched from a provided
* web service URL or handles any other OK response returned from the server
*/
export function getData<T = any>(url: string) {
export function getData<T = unknown>(url: string) {
return fetchData<T>(url, {
method: "GET",
credentials: "include" as const,
Expand All @@ -264,7 +264,7 @@ export function getData<T = any>(url: string) {
* Posts JSON data and returns a promise containing JSON fetched from a provided
* web service URL or handles any other OK response returned from the server
*/
export function postData<T = any>(url: string, data: object) {
export function postData<T = unknown>(url: string, data: object) {
return fetchData<T>(url, {
method: "POST",
credentials: "include" as const,
Expand Down

0 comments on commit 3448630

Please sign in to comment.