Skip to content

Tuples as types for rest ...arguments #5331

Closed
@g162h3

Description

@g162h3

This feature could be used in observable-like generic classes/interfaces:

interface EventSource<Args extends any[]> {
  observe(listener: (...args: Args)): void;
  map<T>(mapping: (...args: Args) => T): EventSource<[T]>;
}

Currently the only way I know of is to fallback to any.

Metadata

Metadata

Assignees

Labels

FixedA PR has been merged for this issueSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions