chore(plugin-cloud-storage): enable TypeScript strict (#11850)

This commit is contained in:
Germán Jabloñski
2025-04-03 10:06:25 -03:00
committed by GitHub
parent 308cb64b9c
commit d47b753898
8 changed files with 10 additions and 16 deletions

View File

@@ -88,11 +88,11 @@ export const getFields = ({ collection, prefix }: Args): Field[] => {
type: 'group',
fields: [
{
...(existingSizeURLField || ({} as any)),
...(existingSizeURLField || {}),
...baseURLField,
},
],
}
} as Field
}),
}

View File

@@ -108,7 +108,7 @@ export const getFields = ({
fields: [
...(adapter.fields || []),
{
...(existingSizeURLField || ({} as any)),
...(existingSizeURLField || {}),
...baseURLField,
hooks: {
afterRead: [
@@ -124,7 +124,7 @@ export const getFields = ({
},
},
],
}
} as Field
}),
}

View File

@@ -15,7 +15,9 @@ export const getAfterDeleteHook = ({
try {
const filesToDelete: string[] = [
doc.filename,
...Object.values(doc?.sizes || []).map((resizedFileData) => resizedFileData?.filename),
...Object.values(doc?.sizes || []).map(
(resizedFileData) => resizedFileData?.filename as string,
),
]
const promises = filesToDelete.map(async (filename) => {

View File

@@ -18,7 +18,7 @@ export const getAfterReadHook =
let url = value
if (disablePayloadAccessControl && filename) {
url = await adapter.generateURL({
url = await adapter.generateURL?.({
collection,
data,
filename,

View File

@@ -29,7 +29,7 @@ export const getBeforeChangeHook =
if (typeof originalDoc.sizes === 'object') {
filesToDelete = filesToDelete.concat(
Object.values(originalDoc?.sizes || []).map(
(resizedFileData) => resizedFileData?.filename,
(resizedFileData) => resizedFileData?.filename as string,
),
)
}

View File

@@ -67,9 +67,6 @@ export const cloudStoragePlugin =
if ('clientUploadContext' in args.params) {
return adapter.staticHandler(req, args)
}
// Otherwise still skip staticHandler
return null
})
}

View File

@@ -89,7 +89,7 @@ export const initClientUploads = <ExtraProps extends Record<string, unknown>, T>
clientProps: {
collectionSlug,
enabled,
extra: extraClientHandlerProps ? extraClientHandlerProps(collection) : undefined,
extra: extraClientHandlerProps ? extraClientHandlerProps(collection!) : undefined,
prefix,
serverHandlerPath,
},

View File

@@ -1,9 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
/* TODO: remove the following lines */
"strict": false,
"noUncheckedIndexedAccess": false,
},
"references": [{ "path": "../payload" }, { "path": "../ui" }]
}