Skip to content
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

Allow interface and empty interfaces in .d.ts files #27

Closed
2 tasks done
matejchalk opened this issue Dec 10, 2024 · 0 comments
Closed
2 tasks done

Allow interface and empty interfaces in .d.ts files #27

matejchalk opened this issue Dec 10, 2024 · 0 comments
Assignees

Comments

@matejchalk
Copy link
Contributor

matejchalk commented Dec 10, 2024

It is common to use .d.ts files to extend some shared TypeScript interface like Window. For example, extending matchers in Vitest requires creating a vitest.d.ts as follows:

/* eslint-disable @typescript-eslint/consistent-type-definitions,@typescript-eslint/no-empty-interface */
import type {
  CustomAsymmetricPathMatchers,
  CustomPathMatchers,
} from './lib/extend/path.matcher.js';

declare module 'vitest' {
  interface Assertion extends CustomPathMatchers {}
  interface AsymmetricMatchersContaining extends CustomAsymmetricPathMatchers {}
}

It isn't possible to achieve this with types instead of interfaces, and the empty object is also valid in such cases.

Acceptance criteria

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

No branches or pull requests

1 participant