-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
import @typescript-eslint/typescript-estree 3.9.0 broken on TypeScript 3.9.7 #2388
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
Unfortunately this is one of the problems with moving forwards and supporting the latest version of TS. I'm not sure if we can treat these types as a breaking change, or else we'll be forced to do a breaking change release with every new syntax TS releases, even though there have been no breaking functionality changes within the module itself - this would be quite a burden and slow the project down significantly - major bumps are big task. You can augment the types for TS locally in your repo to silence these errors. Something like will probably do it? import 'typescript';
declare module 'typescript' {
type NamedTupleMember extends Node {}
} |
Hey I completely understand and can only imagine the stress of supporting the new TypeScript releases that have been coming out. Unfortunately the code you gave me did not work 100% in my d.ts file. It first asked for a semicolon then was expecting a import * as ts from 'typescript';
declare module 'typescript' {
type NamedTupleMember = Node;
} The good part is that it would give us errors when we upgrade to TypeScript 4.0.0, in which case we would simply remove the hack. I would kinda like to see this pitfall documented somehow, though. Otherwise please feel free to close this one. |
Thinking about this - the only way for us to "fix" this is by duplicating the definition for the node type locally. The type that consumes Happy to accept a PR if someone wants to clone the |
You need to do: import "typescript";
declare module "typescript" {
// Notice the `interface` keyword:
export interface NamedTupleMember extends Node {}
} Mine will work even with TypeScript 4.x thanks to interface merging. |
This change does seem to solve the issue with both TypeScript 3.9.7 and 4.0.0-beta when I tried it in prettier/prettier#8759. (I did encounter some other issues with prettier/prettier#8759 and TypeScript 4.0.0-beta, which I think are not relevant here.) I will raise a PR next, hope it can be released in time to help with prettier/prettier#8759. Thanks! P.S. I had to change it like this to work with typescript-lint itself, did test it with both TS 3.9.7 & 4.0.0-beta in prettier/prettier#8759: export interface NamedTupleMember extends ts.Node {} |
What:
There seems to be an issue when importing from
@typescript-eslint/typescript-estree
when using TypeScript 3.9.7.I encountered this issue while working on typecheck for Prettier language-js code in prettier/prettier#8759, as described in this comment: prettier/prettier#8759 (comment)
I did notice that
@typescript-eslint/typescript-estree
is testing with typescript 4.0.0-beta. The issue goes away with typescript 4.0.0-beta, which is unfortunately not possible for us to use right now. I think this would evidently be a breaking change.Repro
Here is the reproduction I made in my own work area:
package.json
:a.ts
:Expected Result
Should build with no type error coming from sources in
node_modules/@typescript-eslint/typescript-estree/dist
Actual Result
npx tsc --noEmit --target es2015 --module commonjs a.ts
gave me the following output:When I tried
npm i --save-dev typescript@4.0.0-beta
, then the samenpx tsc
command ran with no errors.Additional Info
OS: macOS Catalina 10.15.6 (19G73)
Versions
@typescript-eslint/typescript-estree
3.9.0
TypeScript
3.9.7
node
v12.18.2
npm
6.14.5
The text was updated successfully, but these errors were encountered: