Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(Input): Add support for Object Expressions in Input decorators #1326

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

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Apr 28, 2023

resolves #1327

In Angular 16, you can pass an object expression as an argument for the Input decorator.

This PR adds support for the following cases:

@Input({ required: <true|false> })
requiredInput: any;

@Input({ alias: 'some-alias' })
aliasedInput: any;

@Input({ required: <true|false>, alias: 'some-alias' })
requiredAndAliased: any;

Additional information:
Hi! I am a Storybook maintainer, and currently, we evaluate Angular 16 support in Storybook, which will be released in the first week of May. Now, Storybook relies heavily on Compodoc to extract type information. Passing an object expression to the Input decorator currently breaks completely because compodoc a) wrongly extracts the name property of the input (it always assumes that a StringLiteral is passed in as the only valid argument) and b) cannot handle object expressions as valid decorator arguments.

Further help needed:
I need help writing a unit test for the mentioned cases. I need some assistance to place a unit test into the right place.

PR opened against master instead of develop
I don't know how stable develop is and whether a soon-ish release of develop might be possible. Therefore, I've created the PR against master, hoping this fix might be released as a hotfix release.

In Angular 16 you are able to pass an object expression as an argument for the Input decorator.

This commit adds support for the following cases:

@input({ required: <true|false> })
@input({ alias: 'some-alias' })
@input({ required: <true|false>, alias: 'some-alias' })
@valentinpalkovic
Copy link
Contributor Author

@vogloblinsky Any chance to get this PR merged soon-ish? Do you know if this project is still maintained?

@vogloblinsky vogloblinsky merged commit e1db6e6 into compodoc:develop May 10, 2023
@vogloblinsky
Copy link
Contributor

Thanks for the PR.

@valentinpalkovic valentinpalkovic deleted the hotfix/support-object-expression branch May 15, 2023 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Angular 16: Support object expressions as input for Input Decorators
3 participants