Describe the bug
|
function mapItem(item: TagItem, category: string): InputType { |
Does not support fields that can be two or more different types or that can be undefined.
storybook will display a Set Object in the control panel

this should be set as String and not object
I realize that if you have a property that has multiple types (it is bad) then storybook cannot decide which one to use
myField: string | boolean
but for optional properties, storybook should support it
To Reproduce
Given the custom element defined as
export class CustomElement extends LitElement {
/**
* Description of the field
*/
@property()
myCustomField?: string;
// .....
}
the generated custom-elements.json will contain
{
"kind": "field",
"name": "myCustomField",
"type": {
"text": "string | undefined"
},
"description": "Description of the field",
"attribute": "myCustomField"
},
System
Environment Info:
System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.0/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
Browsers:
Chrome: 111.0.5563.110
Firefox: 111.0.1
Safari: 16.3
npmPackages:
@storybook/addon-a11y: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/addon-actions: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/addon-docs: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/addon-essentials: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/addon-links: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/blocks: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/types: 7.0.0-alpha.44 => 7.0.0-alpha.44
@storybook/web-components: ^7.0.0-rc.8 => 7.0.0-rc.8
@storybook/web-components-vite: ^7.0.0-rc.8 => 7.0.0-rc.8
### Additional context
_No response_
Describe the bug
storybook/code/renderers/web-components/src/docs/custom-elements.ts
Line 41 in d9d2fbb
Does not support fields that can be two or more different types or that can be undefined.
storybook will display a
Set Objectin the control panelthis should be set as String and not object
I realize that if you have a property that has multiple types (it is bad) then storybook cannot decide which one to use
but for optional properties, storybook should support it
To Reproduce
Given the custom element defined as
the generated
custom-elements.jsonwill containSystem
Environment Info: System: OS: macOS 13.2.1 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.14.0/bin/yarn npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm Browsers: Chrome: 111.0.5563.110 Firefox: 111.0.1 Safari: 16.3 npmPackages: @storybook/addon-a11y: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/addon-actions: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/addon-docs: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/addon-essentials: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/addon-links: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/blocks: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/types: 7.0.0-alpha.44 => 7.0.0-alpha.44 @storybook/web-components: ^7.0.0-rc.8 => 7.0.0-rc.8 @storybook/web-components-vite: ^7.0.0-rc.8 => 7.0.0-rc.8