-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
type-questionA question about expected behavior or functionalityA question about expected behavior or functionalityweb-js-interopIssues that impact all js interopIssues that impact all js interop
Description
It is a compile-time error if a type argument of isA is an extension type on JS primitive type. Is this expected?
extension type MyAny(JSAny _) implements JSAny {}
extension type MyNumber(JSNumber _) implements JSNumber {}
extension type MyString(JSString _) implements JSString {}
extension type MyBoolean(JSBoolean _) implements JSBoolean {}
extension type MyBigInt(JSBigInt _) implements JSBigInt {}
extension type MySymbol(JSSymbol _) implements JSSymbol {}
extension type MyObject(JSObject _) implements JSObject {}
test(JSAny v) {
v.isA<MyAny>(); // Ok
v.isA<MyObject>(); // Ok
v.isA<JSNumber>(); // Ok
v.isA<MyNumber>(); // Error: Type argument 'MyNumber' wraps primitive JS type 'JSNumber', which is specially handled using 'typeof'.
...
}The same error occurs for all other extensions on JS primitive types (MyString, MyBoolean etc). Is this expected? Please note that there is no error for JSNumber but there is for MyNumber.
cc @srujzs
Dart SDK version: 3.10.0-edge.fc16a52f2d5b2a60cb6b98da6ce21b8e8ea1ae40 (main) (Thu Jul 31 18:03:22 2025 -0700) on "linux_x64"
ykmnkmi
Metadata
Metadata
Assignees
Labels
type-questionA question about expected behavior or functionalityA question about expected behavior or functionalityweb-js-interopIssues that impact all js interopIssues that impact all js interop