dart-lang / setup-dart

A GitHub Action to install and setup a Dart SDK.
BSD 3-Clause "New" or "Revised" License
192 stars 38 forks source link

update JS interop - remove JS typedef references #97

Closed devoncarew closed 1 year ago

devoncarew commented 1 year ago

Contribution guidelines:
- See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/wiki/External-Package-Maintenance#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
devoncarew commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

mit-mit commented 1 year ago

Thanks @devoncarew, looks nice