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

Update README to expand on what happens with decorators that return nothing #549

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Oct 17, 2024

No description provided.

@@ -199,7 +199,7 @@ type Decorator = (value: Input, context: {
}) => Output | void;
```

`Input` and `Output` here represent the values passed to and returned from a given decorator. Each type of decorator has a different input and output, and these are covered below in more detail. All decorators can choose to return nothing, which defaults to using the original, undecorated value.
`Input` and `Output` here represent the values passed to and returned from a given decorator. Each type of decorator has a different input and output, and these are covered below in more detail. All decorators can choose to return nothing (undefined, or void in TypeScript), which defaults to using the original undecorated value, or to using the latest value returned by a decorator that has already ran on the same element.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale is that it would be surprising if a void returning function would reset a previous decorators new value back to the original value.

I chose to put "undefined" or "void" here because those are terms I thought to search for when looking for this detail, but couldn't find it.

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.

1 participant