Fix type errors preventing build (#1118)

This commit is contained in:
Filip Sodić 2023-04-07 19:20:06 +02:00 committed by GitHub
parent e960ad3208
commit d8f7a633ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 50 additions and 42 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}
@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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)
}
}

View File

@ -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> = {
@ -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
@ -513,7 +513,7 @@ const VerifyEmailForm = ({ isLoading, setIsLoading, setErrorMessage, setSuccessM
} finally {
setIsLoading(false)
}
})
}
useEffect(() => {
submitForm()

View File

@ -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
},

View File

@ -1,6 +1,6 @@
{{={= =}=}}
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -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 =}

View File

@ -214,7 +214,7 @@
"file",
"server/src/types/index.ts"
],
"82570549b7c746ecc2f95f7497750a506dd297c131c41bd05547de8c844adeda"
"1fd50e251e340a5bc8c51369766e8c889cf892cdbe6593b4d58a6ee585b6d2cc"
],
[
[
@ -529,7 +529,7 @@
"file",
"web-app/tsconfig.json"
],
"27e39dd3e6155ffccdb1d9cb0cba8db7d9e06e10958bee900340a2d9f17400c8"
"887c55937264ea8b2c538340962c3011091cf3eb6b9d39523acbe8ebcdd35474"
],
[
[

View File

@ -1,5 +1,5 @@
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -9,7 +9,7 @@ export type ServerSetupFnContext = {
server: Server,
}
export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'

View File

@ -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
},

View File

@ -221,7 +221,7 @@
"file",
"server/src/types/index.ts"
],
"82570549b7c746ecc2f95f7497750a506dd297c131c41bd05547de8c844adeda"
"1fd50e251e340a5bc8c51369766e8c889cf892cdbe6593b4d58a6ee585b6d2cc"
],
[
[
@ -543,7 +543,7 @@
"file",
"web-app/tsconfig.json"
],
"27e39dd3e6155ffccdb1d9cb0cba8db7d9e06e10958bee900340a2d9f17400c8"
"887c55937264ea8b2c538340962c3011091cf3eb6b9d39523acbe8ebcdd35474"
],
[
[

View File

@ -1,5 +1,5 @@
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -9,7 +9,7 @@ export type ServerSetupFnContext = {
server: Server,
}
export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'

View File

@ -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
},

View File

@ -445,7 +445,7 @@
"file",
"server/src/types/index.ts"
],
"6b9dcc39aee89af771c01c9daf84aa769968081dd9b1b22a96e98f09366b06a8"
"04e01e653bd889436903843cf1dae0a6ba0ecbc1c369beef0e90fae4d0c21127"
],
[
[
@ -592,7 +592,7 @@
"file",
"web-app/src/auth/forms/Auth.tsx"
],
"f62b429c2a3749e8147198184d4612de7d1a82d1370696487b1aa65eb2e4b5b9"
"6e74c3affea9fdc6c71d94fa2875298b4e5bdcf71b89b63320d0a52d81c18652"
],
[
[
@ -907,7 +907,7 @@
"file",
"web-app/tsconfig.json"
],
"27e39dd3e6155ffccdb1d9cb0cba8db7d9e06e10958bee900340a2d9f17400c8"
"887c55937264ea8b2c538340962c3011091cf3eb6b9d39523acbe8ebcdd35474"
],
[
[

View File

@ -1,5 +1,5 @@
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -9,8 +9,8 @@ export type ServerSetupFnContext = {
server: Server,
}
export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'
export { GetUserFieldsFn } from '../auth/providers/oauth/types';
export type { GetUserFieldsFn } from '../auth/providers/oauth/types';

View File

@ -205,7 +205,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> = {

View File

@ -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
},

View File

@ -235,7 +235,7 @@
"file",
"server/src/types/index.ts"
],
"82570549b7c746ecc2f95f7497750a506dd297c131c41bd05547de8c844adeda"
"1fd50e251e340a5bc8c51369766e8c889cf892cdbe6593b4d58a6ee585b6d2cc"
],
[
[
@ -557,7 +557,7 @@
"file",
"web-app/tsconfig.json"
],
"27e39dd3e6155ffccdb1d9cb0cba8db7d9e06e10958bee900340a2d9f17400c8"
"887c55937264ea8b2c538340962c3011091cf3eb6b9d39523acbe8ebcdd35474"
],
[
[

View File

@ -1,5 +1,5 @@
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -9,7 +9,7 @@ export type ServerSetupFnContext = {
server: Server,
}
export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'

View File

@ -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
},

View File

@ -221,7 +221,7 @@
"file",
"server/src/types/index.ts"
],
"82570549b7c746ecc2f95f7497750a506dd297c131c41bd05547de8c844adeda"
"1fd50e251e340a5bc8c51369766e8c889cf892cdbe6593b4d58a6ee585b6d2cc"
],
[
[
@ -543,7 +543,7 @@
"file",
"web-app/tsconfig.json"
],
"27e39dd3e6155ffccdb1d9cb0cba8db7d9e06e10958bee900340a2d9f17400c8"
"887c55937264ea8b2c538340962c3011091cf3eb6b9d39523acbe8ebcdd35474"
],
[
[

View File

@ -1,5 +1,5 @@
import { Application } from 'express'
import { type Application } from 'express'
import { Server } from 'http'
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
@ -9,7 +9,7 @@ export type ServerSetupFnContext = {
server: Server,
}
export { Application } from 'express'
export type { Application } from 'express'
export { Server } from 'http'

View File

@ -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
},