Skip to content

JSAnyUtilityExtension.isA<JSBoxedDartObject>() returns false positives #60644

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

Open
nex3 opened this issue Apr 29, 2025 · 0 comments
Open

JSAnyUtilityExtension.isA<JSBoxedDartObject>() returns false positives #60644

nex3 opened this issue Apr 29, 2025 · 0 comments
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop web-js-interop Issues that impact all js interop

Comments

@nex3
Copy link
Member

nex3 commented Apr 29, 2025

JSAnyUtilityExtension.isA<JSBoxedDartObject>() returns true unexpectedly for values that are not boxed objects when compiled to JS (I haven't tested under WASM). This can be reproduced with the following test:

import 'dart:js_interop';

import 'package:test/test.dart';

void main() {
  group("isA()", () {
    test("returns true for a JSBoxedDartObject", () {
      expect(DateTime.now().toJSBox.isA<JSBoxedDartObject>(), isTrue);
    });

    test("returns false for a JSObject", () {
      expect(JSObject().isA<JSBoxedDartObject>(), isFalse);
    });
  });
}

The first test case passes, the second fails. Tested with Dart 3.7.1.

@nex3 nex3 added the area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop label Apr 29, 2025
@fishythefish fishythefish added the web-js-interop Issues that impact all js interop label Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

2 participants