Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Accept dynamic as an output? #244

@MichaelRFairhurst

Description

@MichaelRFairhurst

In the following code:

@Component(...)
class Foo {
  @Output
  final onSomething = new EventEmitter<X>();
  ...
}

the type of onSomething is dynamic, not EventEmitter<X>. I have opened a ticket with the SDK to perhaps change that: dart-lang/sdk#28541

We then report an error that onSomething should be of type EventEmitter.

What should we do? This is likely to come up again in different forms even if the dart team does accept this inference suggestion. For instance, if the event emitter is not final, they may not use the lower type. Or it may be that a user truly wants dynamic behavior, and to risk getting something wrong and getting runtime errors.

What should we do?

  • accept dynamic?
  • clarify the error message but keep the error the same?
  • make it a different error entirely, perhaps with lower severity?
  • try to inspect the RHS for straightforward cases?

I'm leaning clarification of the error message, maybe a lower severity error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions