You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A type error is thrown when using the typescript-eslint config() helper function to provide type checking for the "flat/recommended" config.
The code:
import tseslint from "typescript-eslint";
import storybook from "eslint-plugin-storybook";
export default tseslint.config(
...storybook.configs["flat/recommended"],
);
By using `as const` on the string values for each of the rule configs,
we ensure that the generated rules have string literal types matching
their configured values.
Fixesstorybookjs#181
Describe the bug
A type error is thrown when using the typescript-eslint
config()
helper function to provide type checking for the "flat/recommended" config.The code:
Versions:
The error:
This is because the declared type for each rule is the wide
string
instead of the more specific"error" | "off" | "warn"
that the config is expecting.To Reproduce
Steps to reproduce the behavior:
eslint-plugin-storybook
andtypescript-eslint
config()
helper functionExpected behavior
The declared type should match the acceptible possible values for the rules.
Additional context
The actual values of the strings in the config are correct, but the type definition file is widened to string.
The text was updated successfully, but these errors were encountered: