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

storybook lib schematic generates bad story code on @HostBinding(attr.id) #9417

Closed
nhhockeyplayer opened this issue Mar 20, 2022 · 1 comment · Fixed by #9780
Closed

storybook lib schematic generates bad story code on @HostBinding(attr.id) #9417

nhhockeyplayer opened this issue Mar 20, 2022 · 1 comment · Fixed by #9780
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug

Comments

@nhhockeyplayer
Copy link

Current Behavior

I have a button widget in a library as follows

export class ButtonComponent {
  static defaultClassName = 'sls-button'
  /** Add optional ID to host
   */
  @HostBinding('attr.id') @Input() id?: string
...
}

i execute the following

nx generate @nrwl/angular:storybook-configuration sls-shared-widgets
nx run sls-shared-widgets:storybook 

schematic had generated bad story code that wont compile

export const Primary = Template.bind({});
Primary.args = {
    attr.id:  '',

compile error is as follows

TS2322: Type '{ attr: any; "": any; button: any; size: "sm"; active: false; disabled: false; style: "primary"; border: "info\""; extraClasses: string; }' is not assignable to type 'Partial<ButtonComponent>'.   Object literal may only specify known properties, and 'attr' does not exist in type 'Partial<ButtonComponent>'.

Expected Behavior

should run storybook and show my button widget

the code generated should look like this

export const Primary = Template.bind({});
Primary.args = {
   id:  '',

Steps to Reproduce

just create a button widget and make its id as above

Environment

NX Report complete - copy this into the issue template

Node : 16.13.0
OS : darwin x64
yarn : 1.22.17

nx : 13.9.3
@nrwl/angular : 13.9.3
@nrwl/cypress : 13.9.3
@nrwl/detox : undefined
@nrwl/devkit : 13.9.3
@nrwl/eslint-plugin-nx : 13.9.3
@nrwl/express : undefined
@nrwl/jest : 13.9.3
@nrwl/js : 13.9.3
@nrwl/linter : 13.9.3
@nrwl/nest : 13.9.3
@nrwl/next : undefined
@nrwl/node : 13.9.3
@nrwl/nx-cloud : undefined
@nrwl/nx-plugin : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.9.3
@nrwl/web : undefined
@nrwl/workspace : 13.9.3
typescript : 4.5.5
rxjs : 7.4.0

Community plugins:
@storybook/angular: 6.4.19

@FrozenPandaz FrozenPandaz added the scope: storybook Issues related to Storybook support in Nx label Mar 25, 2022
Coly010 added a commit to Coly010/nx that referenced this issue Apr 11, 2022
Previously, all decorators were being taken into consideration. However, props to an Angular component would be its Inputs.
We should only consider those.

Fixes nrwl#9417
Coly010 added a commit that referenced this issue Apr 11, 2022
)

Previously, all decorators were being taken into consideration. However, props to an Angular component would be its Inputs.
We should only consider those.

Fixes #9417
FrozenPandaz pushed a commit that referenced this issue Apr 13, 2022
)

Previously, all decorators were being taken into consideration. However, props to an Angular component would be its Inputs.
We should only consider those.

Fixes #9417
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants