Skip to content

rest parameter ts2556 and ts2345Β #57170

Closed

Description

πŸ”Ž 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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