Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

refactor(types): simplify types removing redundant constituents (#1149)

Corentin Thomassetafb780c8da1d
diff --git a/apps/mobile/src/modules/config/config.services.ts b/apps/mobile/src/modules/config/config.services.ts
index b87111c3..80dfd299 100644
--- a/apps/mobile/src/modules/config/config.services.ts
+++ b/apps/mobile/src/modules/config/config.services.ts
@@ -10,7 +10,7 @@ export async function fetchServerConfig({ apiClient }: { apiClient: ApiClient })
});
}
-export async function pingServer({ url }: { url: string }): Promise<true | never> {
+export async function pingServer({ url }: { url: string }): Promise<true> {
const response = await httpClient<{ status: 'ok' | 'error' }>({ url: `/api/ping`, baseUrl: url })
.then(() => true)
.catch(() => false);
diff --git a/apps/papra-client/src/modules/document-views/components/document-view-modals.tsx b/apps/papra-client/src/modules/document-views/components/document-view-modals.tsx
index 25559ad3..6c214a20 100644
--- a/apps/papra-client/src/modules/document-views/components/document-view-modals.tsx
+++ b/apps/papra-client/src/modules/document-views/components/document-view-modals.tsx
@@ -24,11 +24,7 @@ import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/component
import { createDocumentView, updateDocumentView } from '../document-views.services';
const DocumentViewForm: Component<{
- onSubmit: (values: {
- name: string;
- query: string;
- description?: string;
- }) => Promise<unknown> | unknown;
+ onSubmit: (values: { name: string; query: string; description?: string }) => unknown;
initialValues?: { name?: string; query?: string; description?: string | null };
submitButton: JSX.Element;
}> = (props) => {
diff --git a/apps/papra-client/src/modules/shared/http/api-client.models.ts b/apps/papra-client/src/modules/shared/http/api-client.models.ts
index c14b6e08..d55c564f 100644
--- a/apps/papra-client/src/modules/shared/http/api-client.models.ts
+++ b/apps/papra-client/src/modules/shared/http/api-client.models.ts
@@ -1,7 +1,6 @@
-import type { FetchError } from 'ofetch';
import { getErrorStatus } from '../utils/errors';
-export function shouldRefreshAuthTokens({ error }: { error: FetchError | unknown | undefined }) {
+export function shouldRefreshAuthTokens({ error }: { error: unknown }) {
if (!error) {
return false;
}
diff --git a/apps/papra-client/src/modules/tags/pages/tags.page.tsx b/apps/papra-client/src/modules/tags/pages/tags.page.tsx
index 17078da0..5b6e1ed7 100644
--- a/apps/papra-client/src/modules/tags/pages/tags.page.tsx
+++ b/apps/papra-client/src/modules/tags/pages/tags.page.tsx
@@ -77,11 +77,7 @@ const TagColorPicker: Component<{
};
const TagForm: Component<{
- onSubmit: (values: {
- name: string;
- color: string;
- description: string;
- }) => Promise<unknown> | unknown;
+ onSubmit: (values: { name: string; color: string; description: string }) => unknown;
initialValues?: { name?: string; color?: string; description?: string | null };
submitButton: JSX.Element;
}> = (props) => {
diff --git a/oxlint.config.ts b/oxlint.config.ts
index 3e01e685..242c9918 100644
--- a/oxlint.config.ts
+++ b/oxlint.config.ts
@@ -8,6 +8,7 @@ export default defineConfig({
rules: {
'typescript/consistent-type-imports': 'error',
'no-console': 'error',
+ 'typescript/no-redundant-type-constituents': 'error',
},
ignorePatterns: [
'.output/**',
diff --git a/packages/cli/src/client.models.ts b/packages/cli/src/client.models.ts
index b3c0e974..11014a3a 100644
--- a/packages/cli/src/client.models.ts
+++ b/packages/cli/src/client.models.ts
@@ -17,7 +17,7 @@ export function reportClientError(error: Error) {
p.log.error(`${error.message}`);
}
-function getCauseCode(error: Error & { code?: unknown }): unknown | null {
+function getCauseCode(error: Error & { code?: unknown }): unknown {
if (error.code) {
return error.code;
}