chore(storage-uploadthing): enable TypeScript strict (#12304)

This commit is contained in:
Germán Jabloñski
2025-05-02 17:03:38 -03:00
committed by GitHub
parent ddf40d59ac
commit d7d37447aa
3 changed files with 4 additions and 8 deletions

View File

@@ -13,6 +13,6 @@ export const UploadthingClientUploadHandler = createClientUploadHandler({
files: [file], files: [file],
}) })
return { key: res[0].key } return { key: res[0]?.key }
}, },
}) })

View File

@@ -33,7 +33,7 @@ export const getHandler = ({ utApi }: Args): StaticHandler => {
}, },
] ]
if (collectionConfig.upload.imageSizes) { if (collectionConfig?.upload.imageSizes) {
collectionConfig.upload.imageSizes.forEach(({ name }) => { collectionConfig.upload.imageSizes.forEach(({ name }) => {
or.push({ or.push({
[`sizes.${name}.filename`]: { [`sizes.${name}.filename`]: {
@@ -58,7 +58,7 @@ export const getHandler = ({ utApi }: Args): StaticHandler => {
return new Response(null, { status: 404, statusText: 'Not Found' }) return new Response(null, { status: 404, statusText: 'Not Found' })
} }
key = getKeyFromFilename(retrievedDoc, filename) key = getKeyFromFilename(retrievedDoc, filename)!
} }
if (!key) { if (!key) {
@@ -97,7 +97,7 @@ export const getHandler = ({ utApi }: Args): StaticHandler => {
headers: new Headers({ headers: new Headers({
'Content-Length': String(blob.size), 'Content-Length': String(blob.size),
'Content-Type': blob.type, 'Content-Type': blob.type,
ETag: objectEtag, ETag: objectEtag!,
}), }),
status: 200, status: 200,
}) })

View File

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