Skip to content

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

Open
@irfanullahjan

Description

@irfanullahjan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions