Skip to content

fix: add support for exactOptionalPropertyTypes in type definitions #391

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sebastian-altamirano
Copy link

Prerequisites checklist

What is the purpose of this pull request?

When using @eslint/markdown as a plugin in an ESLint config file, TypeScript throws the following error if the exactOptionalPropertyTypes compiler option is enabled:

Type 'typeof plugin' is not assignable to type 'Plugin'.
...
    Type 'undefined' is not assignable to type '(string | string[])[]'.ts(2322)

For example, this can be triggered by using plugins: { markdown } in:

import markdown from "@eslint/markdown";
import { defineConfig } from "eslint/config";

export default defineConfig([
    {
        extends: ["markdown/recommended"],
        files: ["**/*.md"],
        language: "markdown/gfm",
        plugins: { markdown },
        rules: {
            "markdown/no-duplicate-headings": "error",
            "markdown/no-html": "error",
        },
    },
]);

This PR fixes the issue.

What changes did you make? (Give an overview)

I noticed that the Plugin type was unused, so I updated it to be compatible with exactOptionalPropertyTypes and began using it, without breaking existing tests.

Related Issues

-

Is there anything you'd like reviewers to focus on?

-

Copy link

linux-foundation-easycla bot commented May 24, 2025

CLA Signed

  • ✅login: sebastian-altamirano / (9674f9f)

The committers listed above are authorized under a signed CLA.

@sebastian-altamirano sebastian-altamirano changed the title feat: add exactOptionalPropertyTypes to type tests fix: add support for exactOptionalPropertyTypes in type definitions May 24, 2025
@sebastian-altamirano sebastian-altamirano force-pushed the add-exact-optional-property-types branch from 8158703 to 9674f9f Compare May 24, 2025 00:47
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.

1 participant