Repository navigation
feat: prefer type definitions - #22
Open
jobveldhuis wants to merge 1 commit into
Open
jobveldhuis wants to merge 1 commit into
jobveldhuis wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 8e9ecf0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
There was a problem hiding this comment.
🟡 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"], |
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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