storybookjs/storybook

[Bug]: ArgTypes not inferred properly from `custom-elements.json` for cssProperties

Open

#26,395 opened on Mar 9, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (10,058 forks)batch import
bugdocgenhelp wantedsev:S3

Repository metrics

Stars
 (89,909 stars)
PR merge metrics
 (Avg merge 7d 22h) (184 merged PRs in 30d)

Description

Describe the bug

ArgTypes do not seem to be properly inferred from a custom-elements.json file.

Given this JSDoc for a custom element:

/**
 * An example element.
 *
 * @cssproperty {length} [--some-size=1em] - A comment about some size
 * @cssproperty [--animation-duration=1s] - Duration of the animation
 */

and the following custom-elements.json

"cssProperties": [
            {
              "type": {
                "text": "length"
              },
              "description": "The size of the circle",
              "name": "--circle-size",
              "default": "1em"
            },
            {
              "description": "Duration of the circle animation",
              "name": "--animation-duration",
              "default": "1s"
            }
          ],

The controls are displayed as "Object" instead of at least strings.

To Reproduce

https://stackblitz.com/~/github.com/peschee/storybook-cem-test

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (5) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/addon-links: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/blocks: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/test: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/web-components: ^8.0.0-rc.3 => 8.0.0-rc.3 
    @storybook/web-components-vite: ^8.0.0-rc.3 => 8.0.0-rc.3 
    storybook: ^8.0.0-rc.3 => 8.0.0-rc.3

Additional context

No response

Contributor guide