Skip to content

Conversation

@MichaelDeBoey
Copy link
Member

No description provided.

@MichaelDeBoey MichaelDeBoey requested a review from a team September 30, 2023 15:07
@RunDevelopment
Copy link

May I ask what motivates this change?

@MichaelDeBoey
Copy link
Member Author

@RunDevelopment As I already explained in eslint-community/eslint-utils#60 (comment)

  • Interfaces can't express unions, mapped types, or conditional types. Type aliases can express any type.
  • Interfaces with the same name in the same scope merge their declarations, leading to unexpected bugs.
  • Type aliases have an implicit index signature of Record<PropertyKey, unknown>

@RunDevelopment
Copy link

I see. Thank you for sharing, I didn't know about point 3.

That being said, I don't think using type will be possible here. Type expressions are difficult for TS to make sense of when they contain cycles.

@voxpelli
Copy link
Member

voxpelli commented Oct 6, 2023

Though interfaces can eg. be extended, and that's preferred over using intersections: https://github.com/microsoft/TypeScript/wiki/Performance#preferring-interfaces-over-intersections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants