-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Support older minor releases of the TypeScript compiler #2216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We actually do now use downlevel-dts as of 3.1.0 (#2133) after I broke <3.8 by using private class members. You can see the downlevelled TS files in the I also had a play, and I'm not sure why it's not working. Do I have the configuration incorrect? |
If this was true, then I wonder why
That's interesting, because upgrading to TypeScript 3.9 definitely made the error go away. Lemme investigate a little more. |
It doesn't, this is actually 1:1 our index.ts file: typescript-eslint/packages/experimental-utils/src/index.ts Lines 1 to 8 in 906c822
Yeah in testing it looks like any version < 3.8 breaks. It looks like typescript is at the very least understanding the typescript-eslint/packages/experimental-utils/package.json Lines 57 to 63 in 906c822
|
Here's an isolated repro: https://github.com/octogonz/typescript-eslint-repro |
dammit, I know what it is. In that PR I originally was going to call the folder During testing by locally linking, I must not have nuked the old Fixing that line makes it work fine. |
This will be released to the |
Awesome, thanks for the quick fix! |
Repro
Create a TypeScript file that imports the
@typescript-eslint
library like this:index.ts
Expected Result
The code compiles without errors using an older compiler (TypeScript 3.5 in our case).
Actual Result
Compilers older than TypeScript 3.7 fail to build:
The reason is that the excerpt below is using a newer language feature that is not supported by older compilers:
@typescript-eslint/experimental-utils/dist/index.d.ts
Additional Info
It would be nice for projects to always use the latest TypeScript compiler version. However, in large production code bases, upgrading the compiler can involve a lot of work. For example, maybe there are custom plugins or tools that need to be updated to work with the latest compiler engine. Or the upgrades may be blocked behind the release of a customer SDK that targets a specific TypeScript version.
The TypeScript group does not guarantee that .d.ts files will be backwards compatible for a previous minor version. (The 3.7 release famously broke backwards compatibility even for source code that avoids using any new language features.)
The recommendation is for libraries to use the downlevel-dts tool to rewrite the .d.ts outputs to be backwards compatible with earlier compiler releases.
Versions
@typescript-eslint/experimental-utils
3.3.0
TypeScript
3.5.3
node
12.17.0
npm
6.14.4
The text was updated successfully, but these errors were encountered: