Support ?? in observable bindings#33
Merged
rajsite merged 8 commits intoarchives/fast-element-1from Feb 3, 2026
Merged
Conversation
m-akinc
commented
Feb 2, 2026
m-akinc
commented
Feb 2, 2026
rajsite
reviewed
Feb 2, 2026
rajsite
reviewed
Feb 2, 2026
rajsite
reviewed
Feb 2, 2026
rajsite
requested changes
Feb 3, 2026
Member
rajsite
left a comment
There was a problem hiding this comment.
Waiting for successful build 👍
jattasNI
approved these changes
Feb 3, 2026
rajsite
approved these changes
Feb 3, 2026
Member
rajsite
left a comment
There was a problem hiding this comment.
Looks like most of the test suite was accidentally disabled. If enabling the tests causes additional changes to be needed would like to take a look, please reset. If enabling the tests allows them to pass without further changes then feel free to merge
packages/web-components/fast-element/src/templating/compiler.spec.ts
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Motivation
We are enabling a new eslint rule (
@typescript-eslint/strict-boolean-expressions) in Nimble that disallows using non-booleans in boolean expressions. We have some template bindings likex.foo || 'default_val'which are flagged by this rule and would ideally be rewritten asx.foo ?? 'default_val'. However, without proper support for??in binding expressions, we would have to rewrite them asx.foo !== undefined ? x.foo : 'default_value', which is excessively verbose.📖 Description
See ni/nimble#2127
The observable binding logic uses a regex pattern to determine which kinds of expressions in a binding should cause the binding to be marked as volatile. The regex did not include
??, presumably because the FAST libraries targetedes2015, in which a binding like(x) => x.trigger ?? x.valuewould be transpiled to something like(x) => { var _a; return (_a = x.trigger) !== null && _a !== void 0 ? _a : x.value; }. However, a client library like Nimble, which targets a later version of the language that directly supports??requires FAST to include??in its regex.As part of this change, I've:
??es2022(for consistency with our client libraries)