From e33b7f475449ad2c786ed72f8ed44465129f5ce7 Mon Sep 17 00:00:00 2001 From: KevinLeScouarnec Date: Tue, 1 Oct 2024 16:57:47 -0400 Subject: [PATCH 1/3] improvement: upgrade typescript and target --- components/StyledDropzone.tsx | 2 +- lib/currency-utils.ts | 4 +++- package-lock.json | 8 ++++---- package.json | 2 +- tsconfig.json | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/StyledDropzone.tsx b/components/StyledDropzone.tsx index 1654c0e634a..dff9d7ea0a4 100644 --- a/components/StyledDropzone.tsx +++ b/components/StyledDropzone.tsx @@ -162,7 +162,7 @@ const StyledDropzone = ({ onDrop?.(acceptedFiles, fileRejections); if (collectFilesOnly) { - onSuccess?.(acceptedFiles, fileRejections); + onSuccess?.(acceptedFiles as File[] & UploadedFile[] & UploadedFile, fileRejections); } else if (useGraphQL) { uploadFileWithGraphQL( acceptedFiles.map(file => ({ file, kind, parseDocument, parsingOptions })), diff --git a/lib/currency-utils.ts b/lib/currency-utils.ts index ae08b87141b..55dfdb6c8b1 100644 --- a/lib/currency-utils.ts +++ b/lib/currency-utils.ts @@ -14,6 +14,8 @@ export type Options = { currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name'; }; +type CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'name' | 'code'; + function getCurrencySymbolFallback(currency: Currency): string { return Number(0) .toLocaleString('en-US', { @@ -85,7 +87,7 @@ export function formatCurrency( maximumFractionDigits = 0; } - const formatAmount = (currencyDisplay: string): string => { + const formatAmount = (currencyDisplay: CurrencyDisplay): string => { return amount.toLocaleString(options.locale, { style: options.style || 'currency', currency, diff --git a/package-lock.json b/package-lock.json index 74eff039441..d050a4c6781 100644 --- a/package-lock.json +++ b/package-lock.json @@ -220,7 +220,7 @@ "tailwindcss-animate": "1.0.7", "ts-unused-exports": "^10.1.0", "tsx": "^4.11.2", - "typescript": "^5.3.2", + "typescript": "^5.6.2", "url-loader": "^4.1.1", "webpack": "^5.91.0" }, @@ -37478,9 +37478,9 @@ } }, "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index cc463c6b59b..0e242e0bf80 100644 --- a/package.json +++ b/package.json @@ -286,7 +286,7 @@ "tailwindcss-animate": "1.0.7", "ts-unused-exports": "^10.1.0", "tsx": "^4.11.2", - "typescript": "^5.3.2", + "typescript": "^5.6.2", "url-loader": "^4.1.1", "webpack": "^5.91.0" }, diff --git a/tsconfig.json b/tsconfig.json index 19fd7959a84..d0a3a1f5628 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "ESNext", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "checkJs": false, From 4f747989351850f4b75f4e2c24e378ac60778213 Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Mon, 14 Oct 2024 08:47:08 +0200 Subject: [PATCH 2/3] types: restore initial TS compilation target --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index d0a3a1f5628..19fd7959a84 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ESNext", + "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "checkJs": false, From 7aeef25c3dedf17a9ab39456866f45b6223f4a6a Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Mon, 14 Oct 2024 08:47:42 +0200 Subject: [PATCH 3/3] types: re-use CurrencyDisplay --- lib/currency-utils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/currency-utils.ts b/lib/currency-utils.ts index 55dfdb6c8b1..de4aba0b727 100644 --- a/lib/currency-utils.ts +++ b/lib/currency-utils.ts @@ -14,8 +14,6 @@ export type Options = { currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name'; }; -type CurrencyDisplay = 'symbol' | 'narrowSymbol' | 'name' | 'code'; - function getCurrencySymbolFallback(currency: Currency): string { return Number(0) .toLocaleString('en-US', { @@ -87,7 +85,7 @@ export function formatCurrency( maximumFractionDigits = 0; } - const formatAmount = (currencyDisplay: CurrencyDisplay): string => { + const formatAmount = (currencyDisplay: Options['currencyDisplay']): string => { return amount.toLocaleString(options.locale, { style: options.style || 'currency', currency,