René's URL Explorer Experiment


Title: Deprecated decorator factory APIs throw "Invalid arguments" runtime error · Issue #50259 · microsoft/TypeScript · GitHub

Open Graph Title: Deprecated decorator factory APIs throw "Invalid arguments" runtime error · Issue #50259 · microsoft/TypeScript

X Title: Deprecated decorator factory APIs throw "Invalid arguments" runtime error · Issue #50259 · microsoft/TypeScript

Description: 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 not undefined: t.factory.createConstructorDeclaration(decorators, modifiers, parameters, b...

Open Graph Description: 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 not undefined: t.factory.createConstructorDeclarat...

X Description: 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 not undefined: t.factory.createConstruct...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/50259

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deprecated decorator factory APIs throw \"Invalid arguments\" runtime error","articleBody":"# Bug Report\r\n\r\nThe following factory methods, that got deprecated in 4.8, throw an \"Invalid arguments\" type error at runtime, if the `body` parameter is not `undefined`:\r\n\r\n```\r\nt.factory.createConstructorDeclaration(decorators, modifiers, parameters, body);\r\nt.factory.updateConstructorDeclaration(ctor, decorators, modifiers, parameters, body);\r\n```\r\n\r\n### 🔎 Search Terms\r\n\r\nInvalid arguments, createConstructorDeclaration, updateConstructorDeclaration\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 4.7.4 and 4.8.0-dev.20220809\r\n\r\n### ⏯ Playground Link\r\n\r\nI don't think this can be reproduced in the playground.\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.8.0-beta#code/MYewdgzgLgBFEwLwwE4FMCOBXAlugFAORQCeADmhMCjmVIQJQDcAUC6JLAEYA2IwAayRwIAOgBmAQ2BQQKEqOppJUNACE+g-AG0AuszYB6QzADucgRHbhoMGXOHwJ02fMXoVaAMI2oKLPYoACJowDySKCo44PgsMDCGAFQwALYgACY44jhoKAiJJlhg6WjZYGjpADRxCclkEZIpaKp5MAUwetXxSTBcGSRtJrz8AtUGLMZmFlYctgD6WGTpnulergByaKYAgmQ4jmJSgQqLy6o+nP6BIWENUNFgsfGBXbWpGVk5re2BommZ2VyEFePXqkSaLXyJl+YMazSBIOSfXSAx+rlEyJIY1YExMUAAFigQKYEAAVchoACiKCJKHwACIAJJgABukh4OHSMAiAHMsE0wPB6QZZrA5oEAPI8dK7fbIJxHVwKJSeC7QK6uG7hSL3GI1HolUA6uRQmBFEplCqI94Ar6m82lHDlKr6uoNCFAwYdXTWzFe4aCbFGPGE4lkinU2kM5lsjlc3n8tCCiDC1iimALJYrNZyEJkdDAFayg7OY6iU6q3wa3OhbVRPXPVzWw1yFQmr2-FvGvLW-6fT1ouR-D6AvIAfgkOB4LXwThwEAAsiOvgxrbCPd9oej1-Ce67ev0O+jMdigA)\r\n\r\n### 💻 Code\r\n\r\nTo reproduce, you can:\r\n\r\n```sh\r\n$ mkdir repro\r\n$ npm init --yes\r\n$ npm install typescript@4.8.0-dev.20220809\r\n```\r\n\r\nAdd the following code in a file `index.js`. Then run `node index.js`.\r\n\r\n```ts\r\nconst ts = require('typescript');\r\n\r\nconst block = ts.factory.createBlock([]);\r\n\r\n// works\r\nconst ctor = ts.factory.createConstructorDeclaration(\r\n  /* modifiers */ undefined,\r\n  /* parameters */ [],\r\n  /* body */ block,\r\n);\r\n\r\n// works\r\nconst _updatedCtorNewApi = ts.factory.updateConstructorDeclaration(\r\n  ctor,\r\n  /* modifiers */ ctor.modifiers,\r\n  /* parameters */ ctor.parameters,\r\n  /* body */ ctor.body,\r\n);\r\n\r\n// throws TypeError(\"Invalid arguments\");\r\nconst _ctorOldApi = ts.factory.createConstructorDeclaration(\r\n  /* decorators */ undefined,\r\n  /* modifiers */ undefined,\r\n  /* parameters */ [],\r\n  /* body */ block,\r\n);\r\n\r\n// throws TypeError(\"Invalid arguments\");\r\nconst _updatedCtorDeprecatedApi = ts.factory.updateConstructorDeclaration(\r\n  ctor,\r\n  /* decorators */ ctor.decorators,\r\n  /* modifiers */ ctor.modifiers?.filter(ts.isModifier),\r\n  /* parameters */ ctor.parameters,\r\n  /* body */ ctor.body,\r\n);\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nThe 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.\r\n\r\n### 🙂 Expected behavior\r\n\r\nNo error 🙂 \r\n\r\n### 🕵️ Cause\r\n\r\nIf I understand the deprecation function overload logic correctly, the issue is here:\r\n\r\nhttps://github.com/microsoft/TypeScript/blob/3c3909b8d0a3d81cf320a84dac373eac19de3a7a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts#L538\r\n\r\nhttps://github.com/microsoft/TypeScript/blob/3c3909b8d0a3d81cf320a84dac373eac19de3a7a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts#L566\r\n\r\nThis should use `isBlock(body)` (without the negation).","author":{"url":"https://github.com/frigus02","@type":"Person","name":"frigus02"},"datePublished":"2022-08-10T14:00:16Z","url":"https://github.com/microsoft/TypeScript/issues/50259"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c65b6867-80ca-c3ca-3879-06ac7851dd57
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCBBE:2BE220:5D7941:7ECC94:6B00D47E
html-safe-nonce00f76173bbaf2f03bb488761f4f94798941fbe64e4401cf3a05e29a940c45466
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkJFOjJCRTIyMDo1RDc5NDE6N0VDQzk0OjZCMDBENDdFIiwidmlzaXRvcl9pZCI6IjcxNjA1NzY2Mjg4MDY5NjQzNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0e729b8a3f6ac0e0aff8df11b1c1f2cd0f42401f771114371e4dad30ae66e2c8
hovercard-subject-tagissue:1334677301
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/50259/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8b3ce7d7296a49f077b7582e1e2186ce2c7a4bff53deed4fc5e7ecb63522d55b/microsoft/TypeScript/issues/50259
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8b3ce7d7296a49f077b7582e1e2186ce2c7a4bff53deed4fc5e7ecb63522d55b/microsoft/TypeScript/issues/50259
og:image:altBug Report The following factory methods, that got deprecated in 4.8, throw an "Invalid arguments" type error at runtime, if the body parameter is not undefined: t.factory.createConstructorDeclarat...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefrigus02
hostnamegithub.com
expected-hostnamegithub.com
None85bbdfe2b6ba16e234513bc6ceff5d848ef8449820c900692a2b4e67061931e5
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4943239a6d2c591325dad6e5c313e1cafda877f6
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/50259#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F50259
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F50259
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/50259
Reloadhttps://github.com/microsoft/TypeScript/issues/50259
Reloadhttps://github.com/microsoft/TypeScript/issues/50259
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/50259
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/50259
#50343https://github.com/microsoft/TypeScript/pull/50343
Deprecated decorator factory APIs throw "Invalid arguments" runtime errorhttps://github.com/microsoft/TypeScript/issues/50259#top
#50343https://github.com/microsoft/TypeScript/pull/50343
https://github.com/rbuckton
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
TypeScript 4.9.0https://github.com/microsoft/TypeScript/milestone/169
https://github.com/frigus02
Jan Kühle (frigus02)https://github.com/frigus02
on Aug 10, 2022https://github.com/microsoft/TypeScript/issues/50259#issue-1334677301
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=4.8.0-beta#code/MYewdgzgLgBFEwLwwE4FMCOBXAlugFAORQCeADmhMCjmVIQJQDcAUC6JLAEYA2IwAayRwIAOgBmAQ2BQQKEqOppJUNACE+g-AG0AuszYB6QzADucgRHbhoMGXOHwJ02fMXoVaAMI2oKLPYoACJowDySKCo44PgsMDCGAFQwALYgACY44jhoKAiJJlhg6WjZYGjpADRxCclkEZIpaKp5MAUwetXxSTBcGSRtJrz8AtUGLMZmFlYctgD6WGTpnulergByaKYAgmQ4jmJSgQqLy6o+nP6BIWENUNFgsfGBXbWpGVk5re2BommZ2VyEFePXqkSaLXyJl+YMazSBIOSfXSAx+rlEyJIY1YExMUAAFigQKYEAAVchoACiKCJKHwACIAJJgABukh4OHSMAiAHMsE0wPB6QZZrA5oEAPI8dK7fbIJxHVwKJSeC7QK6uG7hSL3GI1HolUA6uRQmBFEplCqI94Ar6m82lHDlKr6uoNCFAwYdXTWzFe4aCbFGPGE4lkinU2kM5lsjlc3n8tCCiDC1iimALJYrNZyEJkdDAFayg7OY6iU6q3wa3OhbVRPXPVzWw1yFQmr2-FvGvLW-6fT1ouR-D6AvIAfgkOB4LXwThwEAAsiOvgxrbCPd9oej1-Ce67ev0O+jMdigA
TypeScript/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.tshttps://github.com/microsoft/TypeScript/blob/3c3909b8d0a3d81cf320a84dac373eac19de3a7a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts#L538
3c3909bhttps://github.com/microsoft/TypeScript/commit/3c3909b8d0a3d81cf320a84dac373eac19de3a7a
TypeScript/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.tshttps://github.com/microsoft/TypeScript/blob/3c3909b8d0a3d81cf320a84dac373eac19de3a7a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts#L566
3c3909bhttps://github.com/microsoft/TypeScript/commit/3c3909b8d0a3d81cf320a84dac373eac19de3a7a
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Aug 10, 2022https://github.com/microsoft/TypeScript/issues/50259#event-7167614785
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Ron Buckton (rbuckton)https://github.com/rbuckton
on Aug 10, 2022https://github.com/microsoft/TypeScript/issues/50259#event-7167615029
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.9.0https://github.com/microsoft/TypeScript/milestone/169
on Aug 10, 2022https://github.com/microsoft/TypeScript/issues/50259#event-7167615134
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Aug 17, 2022https://github.com/microsoft/TypeScript/issues/50259#event-7208969611
Ron Buckton (rbuckton)https://github.com/rbuckton
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#50343https://github.com/microsoft/TypeScript/pull/50343
on Aug 19, 2022https://github.com/microsoft/TypeScript/issues/50259#event-7224259159
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/50259
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/50259
Ron Buckton (rbuckton)https://github.com/rbuckton
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
TypeScript 4.9.0https://github.com/microsoft/TypeScript/milestone/169
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.