Skip to content

Add generic types to "new Collection.from" and "new Collection.unmodifiable" arguments #26383

Closed
@nex3

Description

@nex3

Right now, new List.from() and similar APIs take arguments with no generic types. This interferes with inference when using strong mode in two ways:

  • If downward inference doesn't apply in the situation where new List.from() is used, the user has to explicitly write the generic parameter since upwards inference can't work.
  • If downward inference does apply, then the argument could have the wrong type and the user wouldn't be able to tell until runtime.

Neither of these situations is particularly useful. As we go forth into a strong-mode-by-default world, these APIs should get updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions