Skip to content

Commit 89c714c

Browse files
Copilottypicode
andauthored
Drop Node.js 20 support and enforce erasable TypeScript syntax (#1671)
* Initial plan * Drop Node.js 20 support, upgrade to TypeScript 5.9, add erasableSyntaxOnly, convert enum to const Co-authored-by: typicode <5502029+typicode@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: typicode <5502029+typicode@users.noreply.github.com>
1 parent 03301bc commit 89c714c

6 files changed

Lines changed: 22 additions & 19 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [20.x, 22.x]
19+
node-version: [22.x]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v4
1818
- uses: actions/setup-node@v4
1919
with:
20-
node-version: 20
20+
node-version: 22
2121
- run: npm ci
2222
- run: npm test
2323

@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-node@v4
3232
with:
33-
node-version: 20
33+
node-version: 22
3434
registry-url: https://registry.npmjs.org/
3535
- run: npm ci
3636
- run: npm publish --provenance --access public

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"views"
1313
],
1414
"engines": {
15-
"node": "^20.19.0 || >=22.12.0"
15+
"node": ">=22.12.0"
1616
},
1717
"scripts": {
1818
"dev": "tsx watch src/bin.ts fixtures/db.json",
@@ -40,7 +40,7 @@
4040
"tempy": "^3.1.0",
4141
"tsx": "^4.19.1",
4242
"type-fest": "^4.26.1",
43-
"typescript": "^5.6.2"
43+
"typescript": "^5.9.3"
4444
},
4545
"dependencies": {
4646
"@tinyhttp/app": "^2.4.0",

src/service.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ export function isData(obj: unknown): obj is Record<string, Item[]> {
2424
)
2525
}
2626

27-
enum Condition {
28-
lt = 'lt',
29-
lte = 'lte',
30-
gt = 'gt',
31-
gte = 'gte',
32-
ne = 'ne',
33-
default = '',
34-
}
27+
const Condition = {
28+
lt: 'lt',
29+
lte: 'lte',
30+
gt: 'gt',
31+
gte: 'gte',
32+
ne: 'ne',
33+
default: '',
34+
} as const
35+
36+
type Condition = typeof Condition[keyof typeof Condition]
3537

3638
function isCondition(value: string): value is Condition {
3739
return Object.values<string>(Condition).includes(value)

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "@sindresorhus/tsconfig",
33
"exclude": ["src/**/*.test.ts"],
44
"compilerOptions": {
5-
"outDir": "./lib"
5+
"outDir": "./lib",
6+
"erasableSyntaxOnly": true
67
}
78
}

0 commit comments

Comments
 (0)