Skip to content

Commit d47b753

Browse files
authored
chore(plugin-cloud-storage): enable TypeScript strict (#11850)
1 parent 308cb64 commit d47b753

File tree

8 files changed

+10
-16
lines changed

8 files changed

+10
-16
lines changed

packages/plugin-cloud-storage/src/admin/fields/getFields.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ export const getFields = ({ collection, prefix }: Args): Field[] => {
8888
type: 'group',
8989
fields: [
9090
{
91-
...(existingSizeURLField || ({} as any)),
91+
...(existingSizeURLField || {}),
9292
...baseURLField,
9393
},
9494
],
95-
}
95+
} as Field
9696
}),
9797
}
9898

packages/plugin-cloud-storage/src/fields/getFields.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const getFields = ({
108108
fields: [
109109
...(adapter.fields || []),
110110
{
111-
...(existingSizeURLField || ({} as any)),
111+
...(existingSizeURLField || {}),
112112
...baseURLField,
113113
hooks: {
114114
afterRead: [
@@ -124,7 +124,7 @@ export const getFields = ({
124124
},
125125
},
126126
],
127-
}
127+
} as Field
128128
}),
129129
}
130130

packages/plugin-cloud-storage/src/hooks/afterDelete.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export const getAfterDeleteHook = ({
1515
try {
1616
const filesToDelete: string[] = [
1717
doc.filename,
18-
...Object.values(doc?.sizes || []).map((resizedFileData) => resizedFileData?.filename),
18+
...Object.values(doc?.sizes || []).map(
19+
(resizedFileData) => resizedFileData?.filename as string,
20+
),
1921
]
2022

2123
const promises = filesToDelete.map(async (filename) => {

packages/plugin-cloud-storage/src/hooks/afterRead.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const getAfterReadHook =
1818
let url = value
1919

2020
if (disablePayloadAccessControl && filename) {
21-
url = await adapter.generateURL({
21+
url = await adapter.generateURL?.({
2222
collection,
2323
data,
2424
filename,

packages/plugin-cloud-storage/src/hooks/beforeChange.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getBeforeChangeHook =
2929
if (typeof originalDoc.sizes === 'object') {
3030
filesToDelete = filesToDelete.concat(
3131
Object.values(originalDoc?.sizes || []).map(
32-
(resizedFileData) => resizedFileData?.filename,
32+
(resizedFileData) => resizedFileData?.filename as string,
3333
),
3434
)
3535
}

packages/plugin-cloud-storage/src/plugin.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ export const cloudStoragePlugin =
6767
if ('clientUploadContext' in args.params) {
6868
return adapter.staticHandler(req, args)
6969
}
70-
71-
// Otherwise still skip staticHandler
72-
return null
7370
})
7471
}
7572

packages/plugin-cloud-storage/src/utilities/initClientUploads.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const initClientUploads = <ExtraProps extends Record<string, unknown>, T>
8989
clientProps: {
9090
collectionSlug,
9191
enabled,
92-
extra: extraClientHandlerProps ? extraClientHandlerProps(collection) : undefined,
92+
extra: extraClientHandlerProps ? extraClientHandlerProps(collection!) : undefined,
9393
prefix,
9494
serverHandlerPath,
9595
},
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
/* TODO: remove the following lines */
5-
"strict": false,
6-
"noUncheckedIndexedAccess": false,
7-
},
83
"references": [{ "path": "../payload" }, { "path": "../ui" }]
94
}

0 commit comments

Comments
 (0)