Skip to content
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

test: Modified to a more strict type #181

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

koji-1009
Copy link
Contributor

ref #178

Support for more strict type requirements in wasm build.

@jonasfj
Copy link
Member

jonasfj commented Dec 2, 2024

Is this a known issue? If not it might be interesting to make a minimum reproducible example and file an issue against the SDK.

It seems like it would be nice if there was a page somewhere with known compatibility issues between Dart when compiled the JS and wasm, respectively.

@koji-1009
Copy link
Contributor Author

Comparing JSArray<JSString> with <String>[] shows that it does not implements Iterable. Running the test on the feat/replace_html branch will result in the following test fail.

To run this test again: /Users/koji/flutter/bin/cache/dart-sdk/bin/dart test test/crypto_subtle_test.dart -p chrome --plain-name 'crypto getRandomValues: not supported type'
00:09 +1415 -14: test/crypto_subtle_test.dart: crypto.subtle generateCryptoKey: success [E]
  Expected: <Instance of 'JSValue'> with `type`: 'secret' and `extractable`: <false> and `usages`: contains all of ['encrypt', 'decrypt']
    Actual: JSValue:<[object CryptoKey]>
     Which: has `usages` with value JSValue:<encrypt,decrypt> which not an <Instance of 'Iterable'>

I think it is because JSString and String are converted by js_interop, but JSArray and List are not. it is true that dart2wasm is more type strict than dart2js, but it is certainly not convenient.

@jonasfj jonasfj merged commit 8cb812a into google:master Dec 3, 2024
8 of 9 checks passed
@koji-1009 koji-1009 deleted the test/strict_type branch December 3, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants