Deprecated decorator factory APIs throw "Invalid arguments" runtime error #50259
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
Bug Report
The following factory methods, that got deprecated in 4.8, throw an "Invalid arguments" type error at runtime, if the
body
parameter is notundefined
:🔎 Search Terms
Invalid arguments, createConstructorDeclaration, updateConstructorDeclaration
🕗 Version & Regression Information
⏯ Playground Link
I don't think this can be reproduced in the playground.
Playground link with relevant code
💻 Code
To reproduce, you can:
Add the following code in a file
index.js
. Then runnode index.js
.🙁 Actual behavior
The deprecated functions createConstructorDeclaration and updateConstructorDeclaration throw an error at runtime. This makes it hard to write code, which works with both TypeScript 4.7 and 4.8.
🙂 Expected behavior
No error 🙂
🕵️ Cause
If I understand the deprecation function overload logic correctly, the issue is here:
TypeScript/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts
Line 538 in 3c3909b
TypeScript/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts
Line 566 in 3c3909b
This should use
isBlock(body)
(without the negation).The text was updated successfully, but these errors were encountered: