-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V2: Bump minimum supported TypeScript version to 4.9.5 (#1231)
- Loading branch information
Showing
18 changed files
with
512 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# TypeScript compatibility tests | ||
|
||
Each package in this directory tests compatibility with a TypeScript version. | ||
|
||
Our compatibility tests use the default settings for `tsconfig.json` that are | ||
generated by running `tsc --init` (with a few minor exceptions). As a result, | ||
for any version we support, we inherently support the default settings | ||
respective to that version of TypeScript. | ||
|
||
### Which versions are tested | ||
|
||
- the earliest TypeScript version we support | ||
- the latest patch release of all minor versions up to the current release | ||
|
||
### Adding a new version | ||
|
||
To add a new minor or major version of TypeScript to the tests, copy the directory | ||
with the latest version, and make the following updates: | ||
|
||
#### package.json | ||
|
||
- Set an appropriate "name" field, for example `"ts5.2.x"`. | ||
- Set the version constraint for the `typescript` dependency, for example `"5.2.x"`. | ||
- Set the version for the `@types/node` dependency. The package uses dist-tags | ||
to tag releases for older TypeScript versions. You have to look up the | ||
corresponding version number on https://www.npmjs.com/package/@types/node?activeTab=versions. | ||
|
||
Delete the `node_modules` directory in the package if it exists, and run `npm install` | ||
from the repository root. | ||
|
||
#### tsconfig.json | ||
|
||
Generate a new `tsconfig.json` with default values with `node_modules/.bin/tsc --init`, | ||
and merge it with the existing one: | ||
- We want to use the default target, module, and other settings. | ||
- We have to include the test sources. | ||
- We explicitly want to emit declaration and declaration maps, because some | ||
transpilation issues only occur when emitting them. | ||
- We explicitly want to check libs. | ||
|
||
### Running and maintaining the tests | ||
|
||
Run `npx turbo run test -F './packages/typescript-compat/*'` to run all tests. | ||
|
||
Unfortunately, `npm` has no mechanism to pin to a dist-tag for `@types/node`, | ||
but the actual version is a moving target. It is necessary to manually verify | ||
that we still use appropriate versions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "ts4.9", | ||
"scripts": { | ||
"test": "node_modules/.bin/tsc --outDir dist" | ||
}, | ||
"dependencies": { | ||
"@connectrpc/connect-conformance": "*", | ||
"@connectrpc/example": "*", | ||
"@types/node": "22.5.4", | ||
"typescript": "4.9.x" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"include": [ | ||
"../../connect-conformance/src/index.ts", | ||
"../../example/src/**/*.ts" | ||
], | ||
// These are the default compiler options for TypeScript v4.9.x, created | ||
// with `tsc --init` (except where noted in comments below) | ||
"compilerOptions": { | ||
// By default, target is es5. For iterables, we need target 2015 or higher, | ||
// or downLevelIteration. | ||
"target": "es2015", | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
// To guard against regression and ensure we are remaining backwards | ||
// compatible, set the skipLibCheck flag to false explicitly. | ||
"skipLibCheck": false, | ||
// Certain errors are only triggered by actually emitting declaration files, | ||
// see https://github.com/bufbuild/protobuf-es/pull/398 | ||
"declaration": true, | ||
"declarationMap": true | ||
} | ||
} |
Oops, something went wrong.