-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
TSError: Interface 'AssertClause' cannot simultaneously extend types 'ImportAttributes' and 'Node' #8047
Comments
Uh oh! @deot, the image you shared is missing helpful alt text. Check your issue body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs. |
See #7968 (comment) Waiting for the TS fix to release with their next release. Until such time you will need to use |
@bradzacher are you sure this is fixed with TS 5.3.3? With these versions:
...and this TS library definition:
...I still get the TypeScript error.
|
Yeah, this doesn't seem to be fixed. Here's a minimal repro: #!/usr/bin/env sh
mkdir example
cd example
npm init --yes > /dev/null
npm install typescript@5.3.3 @typescript-eslint/utils@6.14.0 > /dev/null
echo '{ "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext" } }' > tsconfig.json
echo 'import "@typescript-eslint/utils";' > index.ts
npx tsc
|
👍 thanks for letting us know. Reopening and putting back into triage. As a side curiosity, why are you folks all discovering this? It only happens if you don't have |
Just encountered this issue as well while attempting to upgrade an ESLint plugin with custom rules to typescript-eslint 6.17.0 & typescript 5.3.3. We generally don't enable |
What does
|
This problem also repros with TypeScript Downgrading to TypeScript |
If someone wants to try and solve this - happy to accept a PR. It's just a really, really hard problem, unfortunately. We are trying to support a range of TS versions and they add and remove node types which we depend on. Unfortunately in 5.3 there was a change made which completely broke our existing style of handling the backwards-compatibility. We don't currently have a good solution to fix this. Is But without a concrete solution is the only one we've got right now. More than happy to accept a PR if someone can figure out a solution. If this issue is important to you - consider being that champion. |
@DanielRosenwasser @RyanCavanaugh It's rather important for For example, perhaps the semantic declarations that Or perhaps |
For context. When TS shipped support for import assertions it added the new node types like interface AssertEntry extends Node { ... } For backwards-compatibility we added these nodes to our module type merge as before eg: import * as ts from 'typescript';
declare module 'ts' {
export interface AssertEntry extends Node {}
} This is a bit of a hack but essentially in old versions of TS that don't support In TS 5.3 support for the new and finalised syntax was introduced and the nodes were renamed. But rather than completely remove them instead they were converted to aliases to the new nodes eg type AssertEntry = ImportAttribute; This broke our types because you can't declaration merge an interface into a type. So microsoft/TypeScript#56485 was landed which converted them to interfaces to allow declaration merging. However this unfortunately doesn't completely fix the problem for us because we have two sets of incompatible types now. // TS 4.5 - 5.2
interface AssertEntry extends Node { ... }
// TS 5.3.3+
interface AssertEntry extends ImportAttribute { ... } This is an issue because there's no way we can define a no-op declaration that satisfies both definitions. If we define this (which is what we currently do) interface AssertEntry extends Node {} Then TS>=5.3.3 will error because our no-op interface declares an extension that's different to the original. If we instead define this: interface AssertEntry extends ImportAttribute {} Then TS<5.3 will error because our no-op interface declares an extension that's different to the original. I don't know if there's a way to satisfy both constraints. So we're stuck between a rock and a hard place - we can't provide backwards compatibility support for our supported TS versions. |
If you'd like to try Note: v5.3.2 shall be forever broken as it uses a type alias - so please bump to 5.3.3. |
I checked in DefinitelyTyped-tools, and I can confirm that |
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
When I use
tsc
, I get some errors when build.It seems there are still errors after #7968 fix
#7968 (comment)
Reproduction Repository Link
https://stackblitz.com/edit/nhmdzj?file=index.ts&file=tsconfig.json
Repro Steps
npm install
npm run build
Versions
@typescript-eslint/eslint-plugin
6.13.2
TypeScript
5.3.3
The text was updated successfully, but these errors were encountered: