-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#151) ## Summary INN-1009 Providing a TS library means supporting various versions of TypeScript. Above just watching public API changes, this means: - Ensuring we have an explicit earliest supported TS version - Ensuring we have an explicit earliest supported Node version - Ensuring that earlier TS versions maintain the same level of inference across all tooling TypeScript introduce breaking changes with minor increments, which seems to be the norm among tooling with a large surface area (see [Follow SemVer · Issue #2888 · jashkenas/backbone (github.com)](jashkenas/backbone#2888 (comment))). This also means that TS changes faster than it appears to and that it's harder for users to upgrade TS versions, even though semver might suggest otherwise. Most TS configs will also type-check any installed libraries every time code is built, which results in errors on TS `<4.7.0` as the earlier compiler can't even parse the file due to unexpected characters (see #150). ## Actions There are some fantastic resources covering this problem (see https://www.semver-ts.org/), but even tooling such as [downlevel-dts](https://github.com/sandersn/downlevel-dts) takes a long time to support the latest TS releases (it currently still doesn't support some 4.7 features) _and_ some of the "down-leveling" just falls back to wider types such as `any` or `unknown`, which could be insufficient depending on where it is. The easiest step to take is to add some CI testing for various TypeScript versions and ensure that tests pass and compile. We have a lot of type-only unit tests to assert inference functionality, so testing that against earlier TS versions should do the trick. With this, we can pretty easily support >=4.7.0, though going any further would require some chonky rewrites. The main culprit being [instantiation expressions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#instantiation-expressions) released in [TypeScript 4.7](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html). This PR is mostly about adding a framework for asserting and committing to a specific TS version support, then support for earlier versions can be added in further PRs. Time-wise, it means we can comfortably support TS versions within the last 10 months, and specify that fact in our `peerDependencies`. - ✅ **TypeScript 5.0** - March 2023 (<1mo) - ✅ **TypeScript 4.9** - November 2022 (~4mo) - ✅ **TypeScript 4.8** - August 2022 (~7mo) - ✅ **TypeScript 4.7** - May 2022 (~10mo) - ❌ **TypeScript 4.6** - Feb 2022 (~1y1mo) - ❌ **TypeScript 4.5** - November 2021 (~1y4mo) - ❌ **TypeScript 4.4** - August 2021 (~1y7mo) - ❌ **TypeScript 4.3** - May 2021 (~1y10mo) - ❌ **TypeScript 4.2** - Feb 2021 (~2y1m) - ❌ **TypeScript 4.1** - November 2020 (~2y4m) - ❌ **TypeScript 4.0** - August 2020 (~2y7mo) To test types, we'll do a couple of actions: - [x] Add a new `test:types` script that will test that `dist/` and `src/**/*.test.ts` compile correctly. This will ensure that users with the default of `skipLibCheck: false` can properly build the code, and compiling test files ensures that all type tests are also working. - [x] Add CI matrix to test multiple TS versions against the above files ## Related - #150 --------- Co-authored-by: Igor Gassmann <igor@igassmann.me>
- Loading branch information
1 parent
ca7d79e
commit 906aca5
Showing
16 changed files
with
154 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"inngest": patch | ||
--- | ||
|
||
INN-1009 Show warnings when using the package with TS versions `<4.7.2` and Node versions `<14` | ||
|
||
This includes tests to assert we appropriately support these versions now and in the future. |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"deno.enablePaths": ["./deno_compat"] | ||
"deno.enablePaths": ["./deno_compat"], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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
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
Oops, something went wrong.