Skip to content

Tyep declarations shipped in 14.12.0 are invalid #6353

@stof

Description

@stof

What steps are needed to reproduce the bug?

Write a custom rule importing stylelint
Run the typechecker on that file (which will import the stylelint types).
This will report an error in the stylelint type

What Stylelint configuration is needed to reproduce the bug?

n/a

How did you run Stylelint?

n/a

Which version of Stylelint are you using?

14.12.0

What did you expect to happen?

No type checking error

What actually happened?

node_modules/stylelint/types/stylelint/index.d.ts:356:29 - error TS2344: Type 'RuleMessage' does not satisfy the constraint '(...args: any) => any'.
  Type 'string' is not assignable to type '(...args: any) => any'.

356    messageArgs?: Parameters<RuleMessage> | undefined;
                                ~~~~~~~~~~~


Found 1 error in node_modules/stylelint/types/stylelint/index.d.ts:356

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

Use Parameters<RuleMessageFunc> instead of Parameters<RuleMessage> (RuleMessage is string | RuleMessageFunc) and fix the type linting to actually report such errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: wipis being worked on by someone

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions