-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[breaking change] Change return type of isTruthy and not #55267
Copy link
Copy link
Closed
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.breaking-change-approvedbreaking-change-requestThis tracks requests for feedback on breaking changesThis tracks requests for feedback on breaking changesweb-js-interopIssues that impact all js interopIssues that impact all js interop
Metadata
Metadata
Assignees
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.breaking-change-approvedbreaking-change-requestThis tracks requests for feedback on breaking changesThis tracks requests for feedback on breaking changesweb-js-interopIssues that impact all js interopIssues that impact all js interop
Type
Projects
Status
Complete
Some more context here: #55238. This is the "reverse" of that change - move all operators to use JS types instead of returning Dart types.
Intended Change
dart:js_interop'sisTruthyandnotshould now return aJSBooleaninstead of abool.dart:js_interopexposesisTruthyandnotoperators to be consistent withdart:js_utilAPI. They currently return abool, as the result is always a boolean JS value.Justification
JS operator utility members should use JS types instead of their Dart equivalents for performance. They are likely to be used when the conversion is deemed costly (otherwise, users could just convert to the Dart value and use Dart operators) and they are likely to be composed on one other e.g.
b1.and(b2.or(b3)). In the case of composition, this adds several additional unneeded conversions.Impact
Minimal. There are no usages in google3, in Flutter, in the SDK, or on GitHub.
Mitigation
Convert the resulting
JSBooleanto abooleanwithtoDart:cc @sigmundch