Skip to content

Commit

Permalink
Fix type errors preventing build (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodic authored Apr 7, 2023
1 parent e960ad3 commit d8f7a63
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function login(data: { email: string; password: string }): Promise<
try {
const response = await api.post('{= loginPath =}', data);
await initSession(response.data.token);
} catch (e: unknown) {
} catch (e) {
handleApiError(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function requestPasswordReset(data: { email: string; }): Promise<{
try {
const response = await api.post('{= requestPasswordResetPath =}', data);
return response.data;
} catch (e: unknown) {
} catch (e) {
handleApiError(e);
}
}
Expand All @@ -14,7 +14,7 @@ export async function resetPassword(data: { token: string; password: string; }):
try {
const response = await api.post('{= resetPasswordPath =}', data);
return response.data;
} catch (e: unknown) {
} catch (e) {
handleApiError(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function signup(data: { email: string; password: string }): Promise
try {
const response = await api.post('{= signupPath =}', data);
return response.data;
} catch (e: unknown) {
} catch (e) {
handleApiError(e);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{{={= =}=}}
import api, { handleApiError } from '../../../api';
import api, { handleApiError } from '../../../api'

export async function verifyEmail(data: { token: string; }): Promise<{ success: boolean; reason?: string; }> {
try {
const response = await api.post('{= verifyEmailPath =}', data);
return response.data;
} catch (e: unknown) {
handleApiError(e);
}
export async function verifyEmail(data: {
token: string
}): Promise<{ success: boolean; reason?: string }> {
try {
const response = await api.post('{= verifyEmailPath =}', data)
return response.data
} catch (e) {
handleApiError(e)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ function Auth ({ state, appearance, logo, socialLayout = 'horizontal' }: {
// TODO(matija): this is called on every render, is it a problem?
// If we do it in useEffect(), then there is a glitch between the default color and the
// user provided one.
const customTheme = createTheme(appearance)
const customTheme = createTheme(appearance ?? {})

const cta = isLogin ? 'Log in' : 'Sign up'
const titles: Record<State, string> = {
Expand Down Expand Up @@ -497,7 +497,7 @@ const VerifyEmailForm = ({ isLoading, setIsLoading, setErrorMessage, setSuccessM
const location = useLocation()
const token = new URLSearchParams(location.search).get('token')

const submitForm = useCallback(async () => {
async function submitForm() {
if (!token) {
setErrorMessage('The token is missing from the URL. Please check the link you received in your email.')
return
Expand All @@ -513,7 +513,7 @@ const VerifyEmailForm = ({ isLoading, setIsLoading, setErrorMessage, setSuccessM
} finally {
setIsLoading(false)
}
})
}

useEffect(() => {
submitForm()
Expand Down
1 change: 1 addition & 0 deletions waspc/data/Generator/templates/react-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "@tsconfig/vite-react/tsconfig.json",
"compilerOptions": {
// Temporary loosen the type checking until we can address all the errors.
"jsx": "preserve",
"allowJs": true,
"strict": false
},
Expand Down
8 changes: 4 additions & 4 deletions waspc/data/Generator/templates/server/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{={= =}=}}

import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'

export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
Expand All @@ -10,13 +10,13 @@ export type ServerSetupFnContext = {
server: Server,
}

export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'

{=# isExternalAuthEnabled =}
export { GetUserFieldsFn } from '../auth/providers/oauth/types';
export type { GetUserFieldsFn } from '../auth/providers/oauth/types';
{=/ isExternalAuthEnabled =}

{=# isEmailAuthEnabled =}
export { GetVerificationEmailContentFn, GetPasswordResetEmailContentFn } from '../auth/providers/email/types';
export type { GetVerificationEmailContentFn, GetPasswordResetEmailContentFn } from '../auth/providers/email/types';
{=/ isEmailAuthEnabled =}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d8f7a63

Please sign in to comment.