Skip to content

Commit

Permalink
fix: ts typing, ts config, test config
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed Sep 13, 2024
1 parent 0ceb51d commit a88630a
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ services:
# Bearer token API key format
- API_KEY_VERSION=v1
# env vars for growthbook
- GROWTHBOOK_CLIENT_KEY
- GROWTHBOOK_CLIENT_KEY=growthbook_client_key
# env vars for virus scanner
- VIRUS_SCANNER_LAMBDA_FUNCTION_NAME=function
- WOGAA_SECRET_KEY
Expand Down
6 changes: 6 additions & 0 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ const config: StorybookConfig = {
name: '@storybook/react-vite',
options: {},
},
// For injecitng environment variables into Storybook runs
// (see: https://github.com/storybookjs/storybook/issues/12270#issuecomment-1139104523)
env: (config) => ({
...config,
NODE_ENV: 'test',
}),
}

export default config
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ FormWithPayment.parameters = {
publishable_key: 'pk_samplekey',
},
payments_field: {
payment_type: PaymentType.Fixed,
enabled: true,
description: 'Test event registration fee',
payment_type: PaymentType.Variable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ export const PreviewFormProvider = ({
isPaymentEnabled,
isPreview: true,
hasSingleSubmissionValidationError: false,
hasRespondentNotWhitelistedError: false,
...commonFormValues,
...data,
...rest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const SecretKeyDownloadWhitelistFileModal = ({
[errorToast],
)
const toastSuccessMessage = useCallback(
(message) => {
(message: string) => {
toast.closeAll()
toast({
description: message,
Expand All @@ -62,7 +62,7 @@ export const SecretKeyDownloadWhitelistFileModal = ({
[],
)
const handleWhitelistCsvDownload = useCallback(
({ secretKey }) => {
({ secretKey }: { secretKey: string }) => {
fetchAdminFormEncryptedWhitelistedSubmitterIds(formId, queryClient)
.then((data) => {
const { encryptedWhitelistedSubmitterIds } = data
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/admin-form/settings/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const useMutateFormSettings = () => {
)

const generateErrorToast = useCallback(
(message) => {
(message: string) => {
toast.closeAll()
toast({
description: message,
Expand All @@ -87,7 +87,7 @@ export const useMutateFormSettings = () => {
)

const generateSuccessToast = useCallback(
(message) => {
(message: string) => {
toast.closeAll()
toast({
description: message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const TemplateFormProvider = ({
isPreview: true,
isPaymentEnabled: false,
hasSingleSubmissionValidationError: false,
hasRespondentNotWhitelistedError: false,
...commonFormValues,
...data,
...rest,
Expand Down
78 changes: 59 additions & 19 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": ["DOM", "DOM.Iterable", "ES2020"],
"target": "ES2021",
"lib": [
"DOM",
"DOM.Iterable",
"ES2021"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -18,22 +22,58 @@
"downlevelIteration": true,
"baseUrl": ".",
"paths": {
"~shared/*": ["../shared/*"],
"~assets/*": ["./src/assets/*"],
"~contexts/*": ["./src/contexts/*"],
"~constants/*": ["./src/constants/*"],
"~components/*": ["./src/components/*"],
"~templates/*": ["./src/templates/*"],
"~features/*": ["./src/features/*"],
"~hooks/*": ["./src/hooks/*"],
"~utils/*": ["./src/utils/*"],
"~pages/*": ["./src/pages/*"],
"~services/*": ["./src/services/*"],
"~theme/*": ["./src/theme/*"],
"~typings/*": ["./src/typings/*"],
"~/*": ["./src/*"]
"~shared/*": [
"../shared/*"
],
"~assets/*": [
"./src/assets/*"
],
"~contexts/*": [
"./src/contexts/*"
],
"~constants/*": [
"./src/constants/*"
],
"~components/*": [
"./src/components/*"
],
"~templates/*": [
"./src/templates/*"
],
"~features/*": [
"./src/features/*"
],
"~hooks/*": [
"./src/hooks/*"
],
"~utils/*": [
"./src/utils/*"
],
"~pages/*": [
"./src/pages/*"
],
"~services/*": [
"./src/services/*"
],
"~theme/*": [
"./src/theme/*"
],
"~typings/*": [
"./src/typings/*"
],
"~/*": [
"./src/*"
]
}
},
"include": ["src/**/*", ".storybook/**/*", "./vitest-setup.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
"include": [
"src/**/*",
".storybook/**/*",
"./vitest-setup.ts"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

0 comments on commit a88630a

Please sign in to comment.