Skip to content

Commit 9cd4265

Browse files
committed
feat: remove as unkown as type assertion
1 parent 7ed26fd commit 9cd4265

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/core/server/controllers/search.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ export default {
3737
if (!mainField) return;
3838

3939
const fieldsArr: string[] = ['documentId', ...(mainField ? [mainField] : [])];
40-
4140
const entries = (await strapi.documents(uid).findMany({
4241
filters: {
4342
[mainField]: { $containsi: qStr },
4443
},
44+
// @ts-expect-error
4545
fields: fieldsArr,
46-
} as any)) as unknown as DocumentEntry[];
46+
}));
4747

4848
if (!entries || entries.length === 0) return;
4949

@@ -76,8 +76,9 @@ export default {
7676
.documents(contentType as UID.ContentType)
7777
.findOne({
7878
documentId,
79+
// @ts-expect-error
7980
fields: fieldsArr,
80-
} as any)) as unknown as DocumentEntry | null;
81+
}));
8182

8283
if (!entry) {
8384
throw new errors.NotFoundError('Entry not found');
@@ -86,6 +87,7 @@ export default {
8687
ctx.body = {
8788
id: entry.id,
8889
documentId: entry.documentId,
90+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
8991
...(mainField ? { [mainField]: entry[mainField] } : {}),
9092
};
9193
},

packages/core/server/services/get-main-field.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ interface ContentManagerConfig {
88

99
export const getMainField = async (uid: UID.ContentType): Promise<string | null> => {
1010
const coreStoreSettings = (await strapi
11-
.query('strapi::core-store' as unknown as UID.Schema)
11+
// TODO use documents service instead of any
12+
.query('strapi::core-store' as UID.Schema)
1213
.findMany({
1314
where: { key: `plugin_content_manager_configuration_content_types::${uid}` },
1415
})) as Array<{ value: string }>;

0 commit comments

Comments
 (0)