Skip to content

Fix Debug Failure crash when resolving overloaded decorators with explicit tuple rest parameters#63178

Closed
hayatexe wants to merge 2 commits intomicrosoft:mainfrom
hayatexe:fix-decorator-arity-crash
Closed

Fix Debug Failure crash when resolving overloaded decorators with explicit tuple rest parameters#63178
hayatexe wants to merge 2 commits intomicrosoft:mainfrom
hayatexe:fix-decorator-arity-crash

Conversation

@hayatexe
Copy link
Copy Markdown

Fixes #63094

Description
When utilizing --experimentalDecorators on methods or accessors, the compiler crashed with a Debug Failure. False expression. at getArgumentArityError if a decorator had an explicitly typed tuple rest parameter (e.g. ...args: [any, any, any]) and an overload match failed.

This happened because getLegacyDecoratorArgumentCount incorrectly evaluated signature.parameters.length instead of getParameterCount(signature) when deciding whether the decorator expects 2 or 3 parameters. Since the node length of a rest parameter is 1 (e.g., ...args), the function erroneously returned 2, which bypassed some argument arity checks and later dropped into getArgumentArityError with args.length = 3 and max = 3. This triggered a crash trying to get first() on args.slice(3).

This PR fixes the crash by using getParameterCount(signature) within getLegacyDecoratorArgumentCount to appropriately count effective parameters over rest arguments.

A compiler test is included.

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Feb 22, 2026
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Feb 22, 2026
@Andarist
Copy link
Copy Markdown
Contributor

There is already an open PR fixing this: #63098

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

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

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Crash: Debug Failure. False expression in getArgumentArityError when resolving overloaded decorators with --experimentalDecorators

3 participants