Skip to content

rest parameter ts2556 and ts2345ย #57170

@liukonghe

Description

@liukonghe

๐Ÿ”Ž Search Terms

ts2556 ts2345

๐Ÿ•— Version & Regression Information

version: 5.3.3

โฏ Playground Link

No response

๐Ÿ’ป Code

const BoxGeometry = (_width: number, _height: number) => undefined;
const SphereGeometry = (_radius: number, _height: number, _openEnded?: boolean) => undefined;

export const Geometry = {
  Box: BoxGeometry,
  Sphere: SphereGeometry,
};

type GeometryType = keyof typeof Geometry;

export type GetArgument<T extends GeometryType> = Parameters<(typeof Geometry)[T]>;

export function load<T extends GeometryType>(type: T, args: GetArgument<T>) {
  const geometry = Geometry[type](...args);
}

๐Ÿ™ Actual behavior

image

๐Ÿ™‚ Expected behavior

...args should not report an error

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions