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

update JS interop - remove JS typedef references #97

Merged
merged 6 commits into from Jul 12, 2023
Merged

Conversation

devoncarew
Copy link
Member

@devoncarew devoncarew commented Jul 11, 2023


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@devoncarew
Copy link
Member Author

devoncarew commented Jul 11, 2023

Compilation issues I'm seeing locally:

> dart compile js --enable-experiment=inline-class -olib/main.js lib/main.dart && dart tool/sig.dart --generate

lib/node/actions/core.dart:11:14:
Error: Inline class 'Core' is marked with a '@JS' annotation, but its representation type is not a valid JS interop type: 'InvalidType(<invalid>)'.
inline class Core {
             ^
lib/node/actions/core.dart:12:19:
Error: Inline class member is marked 'external', but the representation type of its inline class is not a valid JS interop type.
  external String getInput(String name);
                  ^
lib/node/actions/core.dart:14:17:
Error: Inline class member is marked 'external', but the representation type of its inline class is not a valid JS interop type.
  external void setOutput(String name, String value);
                ^
lib/node/actions/core.dart:16:17:
Error: Inline class member is marked 'external', but the representation type of its inline class is not a valid JS interop type.
  external void info(String name);
                ^
lib/node/actions/core.dart:17:17:
Error: Inline class member is marked 'external', but the representation type of its inline class is not a valid JS interop type.
  external void warning(String name);
                ^
lib/node/actions/core.dart:18:17:
Error: Inline class member is marked 'external', but the representation type of its inline class is not a valid JS interop type.
  external void error(String name);
                ^
...

@srujzs
Copy link

srujzs commented Jul 11, 2023

Nice, looking good! You're getting those errors because you have to declare a representation field/type on every inline class (now possibly called extension type!). For your purposes, it'll likely always be JSObject. Once the CFE makes it an error to not have a representation field, this will be more obvious.

@devoncarew devoncarew requested a review from srujzs July 11, 2023 23:56
lib/node/actions/http_client.dart Outdated Show resolved Hide resolved
lib/main.dart Outdated Show resolved Hide resolved
@devoncarew devoncarew merged commit e2fce12 into main Jul 12, 2023
22 checks passed
@devoncarew devoncarew deleted the update_interop branch July 12, 2023 00:54
@devoncarew
Copy link
Member Author

cc @mit-mit for FYI re: the updates for the latest inline classes impl.

@mit-mit
Copy link
Member

mit-mit commented Jul 12, 2023

Thanks @devoncarew, looks nice

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.

update to the latest JS interop
3 participants