Skip to content

Commit 93b6ee2

Browse files
committed
fix TS backwards compat following ControlledTransaction. (#1193)
1 parent 393fcce commit 93b6ee2

9 files changed

+109
-184
lines changed

.github/workflows/test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,8 @@ jobs:
208208
- name: Install older TypeScript
209209
run: npm i -D typescript@${{ matrix.typescript-version }} tsd@${{ fromJson('{ "^4.6":"0.20.0", "^4.7":"0.22.0", "^4.8":"0.24.1", "^4.9":"0.27.0", "^5.0":"0.28.1", "^5.2":"0.29.0", "^5.3":"0.30.7", "^5.4":"0.31.2" }')[matrix.typescript-version] }}
210210

211+
- name: Exclude non-backward compatible tests
212+
run: npx tsx ./scripts/exclude-test-files-for-backwards-compat.mts
213+
211214
- name: Run tests with older TypeScript
212215
run: npm run test:typings && npm run test:node:build

package-lock.json

+65-164
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@types/node": "^22.5.0",
8181
"@types/pg": "^8.11.6",
8282
"@types/pg-cursor": "^2.7.2",
83+
"@types/semver": "^7.5.8",
8384
"@types/sinon": "^17.0.2",
8485
"@types/tedious": "^4.0.9",
8586
"better-sqlite3": "^11.2.1",
@@ -90,14 +91,17 @@
9091
"lodash": "^4.17.21",
9192
"mocha": "^10.7.3",
9293
"mysql2": "^3.11.0",
94+
"pathe": "^1.1.2",
9395
"pg": "^8.12.0",
9496
"pg-cursor": "^2.11.0",
9597
"playwright": "^1.46.1",
9698
"prettier": "^3.3.3",
99+
"semver": "^7.6.3",
97100
"sinon": "^18.0.0",
98101
"tarn": "^3.0.2",
99102
"tedious": "^19.0.0",
100103
"tsd": "^0.31.1",
104+
"tsx": "^4.19.1",
101105
"typescript": "^5.6.3"
102106
}
103107
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { writeFile } from 'node:fs/promises'
2+
import { dirname, resolve } from 'pathe'
3+
import { lt } from 'semver'
4+
import { devDependencies } from '../package.json'
5+
6+
const typescriptVersion = devDependencies.typescript.replace('^', '')
7+
const testTsConfigRelativePath = '../test/node/tsconfig.json'
8+
9+
if (lt(typescriptVersion, '5.0.0')) {
10+
const tsconfig = await import('../test/node/tsconfig.json')
11+
12+
await writeFile(
13+
resolve(
14+
dirname(new URL(import.meta.url).pathname),
15+
testTsConfigRelativePath,
16+
),
17+
JSON.stringify({
18+
...tsconfig,
19+
exclude: [...(tsconfig.exclude || []), 'src/async-dispose.test.ts'],
20+
}),
21+
)
22+
}

0 commit comments

Comments
 (0)