-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Angular: Add type support for Angular's input signals #26413
Angular: Add type support for Angular's input signals #26413
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 607e2bf. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
d30c517
to
8181266
Compare
fd040d1
to
762a61f
Compare
@valentinpalkovic compodoc 1.1.24 has been released 👏 for @vogloblinsky. I just tried Angular disabled = input(false, { transform: booleanAttribute }); Compodoc JSON ( "propertiesClass": [
{
"name": "disabled",
"defaultValue": "input(false, { transform: booleanAttribute })",
"deprecated": false,
"deprecationMessage": "",
"type": "",
"optional": false,
"description": "",
"line": 15
},
... Storybook Thank you so much. |
@attilacsanyi The problem is the implementation of the regex here: https://github.com/compodoc/compodoc/pull/1439/files#diff-cdac1a6464ce522cb3a4015afecb77db52b44710804bea99c09ffd6b69b97fd7R141 It is pretty restrictive and does not take into account an options object. Even strings as default arguments are not working. I propose opening a PR in Compodoc's repo to fix this issue. |
@valentinpalkovic When using Angular input signals, it seems that still only string and boolean values are supported with Storybook. For example, in the following story a number signal input is used, although on Storybook still only string input fields are shown. Or does the args object need a special configuration when using signals? stories.ts component.ts |
I guess you are talking about Storybook Controls in the UI. As mentioned above, we rely herefore on Compodoc, which currently has a bug: compodoc/compodoc#1439 (comment) |
Closes #25784
What I did
Support the new signal-based input function in Angular 17.2 and upwards in Storybook's helper types as
StoryObj
orStoryFn
. I also ensured that TypeScript doesn't complain in Angular versions that don't support this feature.Please be aware, that controls might not reflect the proper types when Signals are used. For component and property analysis, we are relying on compodoc. There is a PR, which adds signal-based input support, but the change isn't released yet. In the meantime, you would have to manually set the
argTypes
as described here: https://storybook.js.org/docs/api/arg-typesChecklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
src/stories/frameworks/angular_angular-cli-prerelease/signal/button.stories.ts
size
argument gets properly inferredDocumentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This pull request has been released as version
0.0.0-pr-26413-sha-81812663
. Try it out in a new sandbox by runningnpx [email protected] sandbox
or in an existing project withnpx [email protected] upgrade
.More information
0.0.0-pr-26413-sha-81812663
valentin/add-input-support-for-angular
81812663
1710166666
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=26413