-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(lit-html/directives/when.ts): improve typing #4310
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
🦋 Changeset detectedLatest commit: 4120a4f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummaryA summary of the benchmark results will show here once they finish. ResultsThe full results of your benchmarks will show here once they finish. |
582c880 to
63d626f
Compare
augustjk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR!
The change is pretty minimal but does affect runtime and usage will look different if you want to take advantage of this. Whether we want to document this everywhere I think is up for debate but it should be fine to merge this and leave it as an undocumented feature in the interim.
I did leave a suggestion to make at least the changelog entry more verbose as the one place to document this behavior change.
Improve typing for the `when` directive making it more dynamic.
```ts
let user = {name: string} | undefined;
when(
user,
(user)=>user.name
)
```
In the trueCase and falseCase functions the condition is correctly type
and we no longer need a non-null assertion.
Co-authored-by: Augustine Kim <[email protected]>
b800d32 to
4120a4f
Compare
Improve typing for the
whendirective making it more dynamic.In the trueCase and falseCase functions the condition is correctly type
and we no longer need a non-null assertion.
Fixes #4085