Files
sdk/tests/lib/js/static_interop_test/js_array_test.dart
T
Srujan Gaddam 76193718d2 Reland "[dart:js_interop] Re-enable type checks on external APIs"
This is a reland of commit 2a669c571f.

External APIs when using dart:js_interop should only allow
primitives, JS types, and other static interop types. This
was previously checked in a more restrictive mode called
"strict mode" but is not checked everywhere where dart:js_interop
APIs exist.

Change-Id: I1a8d04071a519c4965b266eb2800bcc3c3bb8393
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-09-18 19:53:40 +00:00

27 lines
638 B
Dart

// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that JS' Array type is interoperable using static interop.
@JS()
library js_array_test;
import 'dart:js_interop';
@JS()
external void eval(String code);
// dart:js_interop top-levels do return-type checks so if the call to these
// getters succeed, it's enough to know they can be interoperable.
@JS()
external JSObject get jsArray;
void main() {
eval('''
this.jsArray = Array();
''');
jsArray;
}