Incorrect typescript typings with addon-jest's `withTests`
See original GitHub issueaddDecorator(withTests({ results }));
leads to a TypeScript error.
Argument of type '(args_0: string | (() => void), args_1: { kind: string; parameters: AddonParameters; }) => void | ((storyFn: () => void, { kind }: { kind: string; }) => void)' is not assignable to parameter of type 'StoryDecorator'.
Types of parameters 'args_1' and 'context' are incompatible.
Property 'parameters' is missing in type '{ kind: string; story: string; }' but required in type '{ kind: string; parameters: AddonParameters; }'.ts(2345)
It looks like the return type of withTests
is not compatible with the accepted argument type of addDecorator
.
To Reproduce In a TypeScript project:
...
import { withTests } from '@storybook/addon-jest';
import results from '../jest-test-results.json';
...
addDecorator(withTests({ results }));
Dependencies @storybook/react: 5.1.11 @storybook/addon-jest: ^5.1.11
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Typescript using the incorrect type with jest when there are ...
When I go to mock a named import with the js-cookie package, it mocks a particular instance of the property, but incorrectly chooses...
Read more >Documentation - Do's and Don'ts - TypeScript
Don't ever use the types Number , String , Boolean , Symbol , or Object These types ... WRONG */. function reverse(s: String):...
Read more >TypeScript - Dynamoose
FAQ. What does beta mean in terms of TypeScript support?. TypeScript Beta Support means that typings might be wrong or missing. This can...
Read more >Typescript imports are incorrectly imported from `@types/`
What steps will reproduce the problem? Use jsx in a tsx file. Get the prompt to import react. Import react; WS inserts import...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @shilman @CodeByAlex It is working now.
@CodeByAlex We got the same error in “@storybook/addon-jest”: “^5.2.3” Please let us know once you deploy the latest version.