Skip to content

Unexpected any[] spreading string into unknown[]-constrained argument position #52781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
RyanCavanaugh opened this issue Feb 15, 2023 · 3 comments Β· Fixed by #52838
Closed

Unexpected any[] spreading string into unknown[]-constrained argument position #52781

RyanCavanaugh opened this issue Feb 15, 2023 · 3 comments Β· Fixed by #52838
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros
Milestone

Comments

@RyanCavanaugh
Copy link
Member

Bug Report

πŸ”Ž Search Terms

any spread string

πŸ•— Version & Regression Information

  • This changed between versions 3.9 and 4.0

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare function foo<T extends unknown[]>(...args: T): T;
// p: any[], expected string[]
const p = foo(..."hello");
// @ts-expect-error
p[0].blah

πŸ™ Actual behavior

p is any[]

πŸ™‚ Expected behavior

p is string[]

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Feb 15, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Feb 15, 2023
@typescript-bot typescript-bot added the Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros label Feb 15, 2023
@typescript-bot
Copy link
Collaborator

The change between origin/release-3.9 and origin/release-4.0 occurred at d479206.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 16, 2023

πŸ‘‹ Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of the repro in the issue body running against the nightly TypeScript.


Issue body code block by @RyanCavanaugh

❌ Failed: -

  • Unused '@ts-expect-error' directive.

Historical Information
Version Reproduction Outputs
4.5.2, 4.6.2, 4.7.2, 4.8.2, 4.9.3

❌ Failed: -

  • Unused '@ts-expect-error' directive.

@Andarist
Copy link
Contributor

Barney Stinson saying dibs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants