Skip to content

[labs/gen-wrapper-angular] Improved @Input types for Angular wrappers #4752

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

Open
1 task done
irfanullahjan opened this issue Aug 31, 2024 · 0 comments
Open
1 task done

Comments

@irfanullahjan
Copy link

irfanullahjan commented Aug 31, 2024

Should this be an RFC?

  • This is not a substantial change

Which package is this a feature request for?

Other/unknown (please mention in description)

Description

The current Angular wrapper generator (labs/gen-wrapper-angular) cannot get complex types for @Input properties. There is an easy fix for this:

Current:

${Array.from(reactiveProperties.entries()).map(
    ([propertyName, property]) => javascript`
  @Input()
  set ${propertyName}(v: ${property.type?.text ?? 'any'}) {
    this._ngZone.runOutsideAngular(() => (this._el.${propertyName} = v));
  }

Proposed:

${Array.from(reactiveProperties.entries()).map(
    ([propertyName, property]) => javascript`
  @Input()
  set ${propertyName}(v: ${name}Element[${propertyName}]) {
    this._ngZone.runOutsideAngular(() => (this._el.${propertyName} = v));
  }

Notice the change: ${name}Element[${propertyName}]

Something similar can be done for events as well. But in this issue I think we can simply fix the Input properties because events could change substantially: Declarative event emitters #3277.

Alternatives and Workarounds

Currently we maintain our own wrapper generation code in-house.

@irfanullahjan irfanullahjan changed the title Improved @Input types for Angular wrappers [labs/gen-wrapper-angular] Improved @Input types for Angular wrappers Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant