[Angular] auto-generated stories need to be cast to any
See original GitHub issueDescribe the bug
I just tried the upcoming Storybook (6.0.0-rc.13) in an Angular project. After initialisation I head to fix all stories because the args
access expressions where invalid.
To Reproduce Steps to reproduce the behavior: 0. create an Angular project in strict mode
- run
npx sb@next init
- run
npm run storybook
Expected behavior The standard storybook should be executable without manual type fixes.
Screenshots
Code snippets I had to tweak the stories with any casts:
export const Primary = Template.bind({}) as any;
Primary.args = {
primary: true,
label: 'Button',
};
System: Well… that was unexpected:
Environment Info:
(node:88453) UnhandledPromiseRejectionWarning: TypeError: e.filter is not a function
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Auto Increment user id for the Array of User Input using ...
you can try something like this. But in the real world the ID should be generated server side i.e. from the DB itself...
Read more >Generate Angular Unit Test Automatically | by Allen Kim
Generate the first unit test automatically ... There is no reason not to automate copying, pasting, and modifying the test codes for each...
Read more >Set up Storybook for Angular Projects - Nx
You first need to set up Storybook for your Nx workspace, if you haven't already. You can read the Storybook plugin overview guide...
Read more >How to set CellStyle with Auto Generated Columns? - Telerik
I tried in code behind but couldn't find what to cast the object ... as Style worked and no I can't use Implicit...
Read more >Angular Data Grid Overview and Configuration - Infragistics
If you use autoGenerate columns the data keys must be identical. Angular Grid Data Binding. Before going any further with the grid we...
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 FreeTop 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
Top GitHub Comments
@gaetanmaisse Actually, I am using Angular 10.0.4.
I guess your E2E tests do not apply the strict mode for Angular. If you do not use strict mode (which entails stricter Typescript settings), you get inferences like these:
So, the story objects are inferred as any and, consequently,
args
can be assigned without problems.In strict mode (
npx -p @angular/cli ng new projectname --strict
), however, the types are inferred more precisely:I just updated the first thread message to reflect this constraint.
This was fixed in #11825 closing!