Skip to content

Commit 8dc59bc

Browse files
committed
fix(client): fix TS errors that appear when users Go to Source in VSCode (#281)
fix #249
1 parent 16fe929 commit 8dc59bc

33 files changed

+8003
-5267
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ We are keen for your feedback; please open an [issue](https://www.github.com/ope
309309

310310
## Requirements
311311

312+
TypeScript >= 4.5 is supported.
313+
312314
The following runtimes are supported:
313315

314316
- Node.js 16 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.

build

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ node scripts/fix-index-exports.cjs
3838
# index.d.mts the default import will work (even though both files have
3939
# the same export default statement)
4040
cp dist/index.d.ts dist/index.d.mts
41-
42-
SED=(sed -i)
43-
if [[ "$OSTYPE" == "darwin"* ]]; then SED=(sed -i ''); fi
41+
cp tsconfig.dist-src.json dist/src/tsconfig.json
4442

4543
# strip out lib="dom" and types="node" references; these are needed at build time,
4644
# but would pollute the user's TS environment
47-
REFERENCE_SUBS='s/^ *\/\/\/ *<reference *lib="dom".*//g;s/^ *\/\/\/ *<reference *types="node".*//g'
48-
find dist -type f -exec "${SED[@]}" "${REFERENCE_SUBS}" {} +
45+
find dist -type f -exec node scripts/remove-triple-slash-references.js {} +
46+
# strip out `unknown extends RequestInit ? never :` from dist/src/_shims;
47+
# these cause problems when viewing the .ts source files in go to definition
48+
find dist/src/_shims -type f -exec node scripts/replace-shim-guards.js {} +
4949

5050
npm exec prettier -- --loglevel=warn --write .
5151

ecosystem-tests/bun/bun.lockb

384 Bytes
Binary file not shown.

ecosystem-tests/bun/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"devDependencies": {
99
"fastest-levenshtein": "^1.0.16",
1010
"bun-types": "latest",
11-
"typescript": "^5.1.0"
11+
"typescript": "5.0.4"
1212
}
1313
}

ecosystem-tests/cli.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const projects = {
4848
await run('npm', ['test']);
4949
}
5050
},
51+
'node-ts-cjs-ts4.5': async () => {
52+
await installPackage();
53+
await run('npm', ['run', 'tsc']);
54+
},
5155
'node-ts-cjs-dom': async () => {
5256
await installPackage();
5357
await run('npm', ['run', 'tsc']);
@@ -296,8 +300,7 @@ async function withRetry(fn: () => Promise<void>, identifier: string, retryAmoun
296300
try {
297301
return await fn();
298302
} catch (err) {
299-
retryAmount--;
300-
if (retryAmount === 0) throw err;
303+
if (--retryAmount <= 0) throw err;
301304
console.error(`${identifier} failed due to ${err}; retries left ${retryAmount}`);
302305
}
303306
} while (retryAmount > 0);

0 commit comments

Comments
 (0)