Skip to content

feat: prefer type definitions - #22

Open
jobveldhuis wants to merge 1 commit into
mainfrom
feat/prefer-type-definitions
Open

jobveldhuis wants to merge 1 commit into
mainfrom
feat/prefer-type-definitions

Conversation

@jobveldhuis

@jobveldhuis jobveldhuis commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Ensures that our linting config is actually up-to-date with the idea of types instead of interfaces.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:46
@changeset-bot

changeset-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8e9ecf0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@incentro-ic/config-eslint Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new rule conflicts with the existing TypeDoc interface policy and documentation.

2 open findings
What changed in this PR

Enforces type aliases over interfaces across the shared ESLint configuration and documents limited exceptions.

Changes:

  • Enables consistent-type-definitions.
  • Expands type-definition guidance and exceptions.
  • Adds a major-version changeset.
File Description
STYLE-GUIDE.md Documents preferred type definitions.
packages/​eslint/​src/​partials/​typescript.ts Enforces type aliases.
.changeset/​prefer-type-definitions.md Records the breaking change.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +69 to +71
// `Record<string, unknown>`. Module augmentation and large `extends`
// hierarchies are valid reasons to disable this rule for one line.
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
Comment thread STYLE-GUIDE.md
There are two exceptions where an interface is the better choice:

- **Module augmentation.** Extending a type declared by a library (like `Window`, or React Router's `Register`) relies on declaration merging, which only interfaces support.
- **Large hierarchies of object types.** When an object type is built by extending several others, prefer `interface … extends` over intersections (`&`). `extends` reports conflicting properties as an error, while an intersection silently turns them into `never`. Typescript also caches `extends` relationships, which keeps type checking fast in large codebases.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants