Skip to content

Add generics to JSArrays and JSPromises #153

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

Merged
merged 4 commits into from
Feb 1, 2024

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jan 31, 2024

Adds a "typeParameter" field to _RawType that keeps track of the generic type for union and emission purposes. Also handles typedefs so that the generic type is always a valid interop type and not a Dart primitive type.

The typedef handling comes at the cost of not having a better name for these types when they appear in generics and some typedefs being potentially unused. The alternative is to make all typedefs JS types but that means an increased need for conversions. From a quick analysis, this would affect several hundred APIs. We may be able to significantly narrow it down by only affecting typedefs that appear as a generic somewhere, but not sure. Another alternative is to have two typedefs, one for the generic and one for the non-generic. This has its own visual downsides as we now have two typedefs for every typedef.

Adds a "typeParameter" field to _RawType that keeps track of the
generic type for union and emission purposes. Also handles typedefs
so that the generic type is always a valid interop type and not a
Dart primitive type. This comes at the cost of not having a better
name for these types when they appear in generics and some typedefs
being potentially unused. The alternative is to make all typedefs
JS types but that means an increased need for conversions. Another
alternative is to have two typedefs, one for the generic and one
for the non-generic. This has its own visual downsides.
@srujzs srujzs requested a review from sigmundch January 31, 2024 23:07
Copy link
Member

@sigmundch sigmundch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

…back recursion on typedefs in union algorithm

Also cleans up some comments.
@srujzs srujzs merged commit 5b026ab into dart-lang:main Feb 1, 2024
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