Skip to content

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

Open
@nex3

Description

@nex3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions