Skip to content

Commit

Permalink
chore: upgrade to TypeScript 5.7, ensure tsconfig targed and lib prop…
Browse files Browse the repository at this point in the history
…erties match the APIs we support (#9473)

TS 5.7 added support for ES2024. By keeping target: “esnext”, we would
have accidentally set our minimum supported ES version to ES2024.

This sets it to ES2022, which is the version supported by Node 18
  • Loading branch information
AlessioGr authored Nov 23, 2024
1 parent 23d54a7 commit 13fc94d
Show file tree
Hide file tree
Showing 47 changed files with 357 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/actions/release-commenter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": ["es2020.string"],
"noEmit": true,
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/triage/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": ["es2020.string"],
"noEmit": true,
"strict": true,
Expand Down
8 changes: 6 additions & 2 deletions examples/auth/next-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES2022",
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/auth/next-pages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down
6 changes: 5 additions & 1 deletion examples/auth/payload/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/custom-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down Expand Up @@ -33,7 +33,7 @@
"src/payload-types.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions examples/draft-preview/next-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES2022",
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/draft-preview/next-pages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/draft-preview/payload/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"strict": false,
Expand Down
8 changes: 4 additions & 4 deletions examples/email/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down Expand Up @@ -33,7 +33,7 @@
"src/payload-types.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions examples/form-builder/next-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/form-builder/next-pages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/form-builder/payload/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand All @@ -30,7 +30,7 @@
"./src/payload.config.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions examples/live-preview/next-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES2022",
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/live-preview/next-pages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2022",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down
6 changes: 5 additions & 1 deletion examples/live-preview/payload/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand Down
8 changes: 4 additions & 4 deletions examples/multi-tenant/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down Expand Up @@ -33,7 +33,7 @@
"src/payload-types.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions examples/tailwind-shadcn-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand All @@ -30,7 +30,7 @@
"./src/payload.config.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions examples/testing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES2022",
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"outDir": "./dist",
"skipLibCheck": true,
"strict": false,
Expand Down
8 changes: 4 additions & 4 deletions examples/whitelabel/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"compilerOptions": {
"baseUrl": ".",
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ES2022"
],
"allowJs": true,
"skipLibCheck": true,
Expand Down Expand Up @@ -33,7 +33,7 @@
"src/payload-types.ts"
]
},
"target": "ES2017"
"target": "ES2022",
},
"include": [
"next-env.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"tempy": "1.0.1",
"tsx": "4.19.2",
"turbo": "^2.1.3",
"typescript": "5.6.3"
"typescript": "5.7.2"
},
"peerDependencies": {
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-regexp": "2.6.0",
"globals": "15.12.0",
"typescript": "5.6.3",
"typescript": "5.7.2",
"typescript-eslint": "8.14.0"
}
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"eslint-plugin-react-hooks": "5.0.0",
"eslint-plugin-regexp": "2.6.0",
"globals": "15.12.0",
"typescript": "5.6.3",
"typescript": "5.7.2",
"typescript-eslint": "8.14.0"
}
}
6 changes: 5 additions & 1 deletion packages/payload/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
"payload/types": ["./src/types/index.ts"]
},
"types": ["jest", "node", "@types/jest"],
"lib": ["dom", "dom.iterable", "esnext"]
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
},
"exclude": [
"dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/translations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"dotenv": "16.4.5",
"prettier": "3.3.3",
"typescript": "5.6.3"
"typescript": "5.7.2"
},
"publishConfig": {
"exports": {
Expand Down
6 changes: 5 additions & 1 deletion packages/translations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"allowJs": true,
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"rootDir": "./src",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"noEmit": false /* Do not emit outputs. */,
"emitDeclarationOnly": false
},
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/src/elements/TableColumns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const TableColumnsProvider: React.FC<Props> = ({
active: activeColumnAccessors.includes(col.accessor),
}
})
.toSorted((first, second) => {
.sort((first, second) => {
const indexOfFirst = activeColumnAccessors.indexOf(first.accessor)
const indexOfSecond = activeColumnAccessors.indexOf(second.accessor)

Expand All @@ -204,7 +204,6 @@ export const TableColumnsProvider: React.FC<Props> = ({

return indexOfFirst > indexOfSecond ? 1 : -1
})

const { state: columnState, Table } = await getTableState({
collectionSlug,
columns: activeColumns,
Expand Down
Loading

0 comments on commit 13fc94d

Please sign in to comment.