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

Incorrect type inference for exported configs object: {} #487

Open
JoshuaKGoldberg opened this issue Aug 1, 2024 · 1 comment
Open

Incorrect type inference for exported configs object: {} #487

JoshuaKGoldberg opened this issue Aug 1, 2024 · 1 comment

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Aug 1, 2024

Right now, when I try to use the plugin in files with type-aware linting and typescript-eslint's recommendedTypeChecked config, I get:

/Users/josh/repos/typescript-eslint-examples/packages/eslint-plugin-example-typed-linting/eslint.config.mjs
  9:5  error  Unsafe argument of type `any` assigned to a parameter of type `ConfigWithExtends`  @typescript-eslint/no-unsafe-argument

...on lines like:

export default tseslint.config(
    eslintPlugin.configs['flat/recommended'],
);

Example: https://github.com/typescript-eslint/examples/blob/b91625d418f63b4bcc5127f2fb213222dcadf3cc/packages/eslint-plugin-example-typed-linting/eslint.config.mjs

The root cause is that the module's exported config object is inferred from .js to be {}:

configs: {}, // assigned later

Normally for a project that isn't written in TypeScript I'd just send a PR to DefinitelyTyped. But because this project already has #310 in its issues, I figured I'd give this a shot. 🙂

@voxpelli
Copy link
Member

voxpelli commented Aug 1, 2024

I’m +1 to generate types for this module

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

No branches or pull requests

2 participants