René's URL Explorer Experiment


Title: [TS 4.8] Deprecated factory methods aren't usable with originalNode.modifiers · Issue #49939 · microsoft/TypeScript · GitHub

Open Graph Title: [TS 4.8] Deprecated factory methods aren't usable with originalNode.modifiers · Issue #49939 · microsoft/TypeScript

X Title: [TS 4.8] Deprecated factory methods aren't usable with originalNode.modifiers · Issue #49939 · microsoft/TypeScript

Description: Bug Report Deprecated factory methods aren't usable with originalNode.modifiers. #49089 changed Node.prototype.modifiers from NodeArray to NodeArray. It also changed factory functions to accept a single No...

Open Graph Description: Bug Report Deprecated factory methods aren't usable with originalNode.modifiers. #49089 changed Node.prototype.modifiers from NodeArray to NodeArray. It also changed...

X Description: Bug Report Deprecated factory methods aren't usable with originalNode.modifiers. #49089 changed Node.prototype.modifiers from NodeArray<Modifier> to NodeArray<Modifier | Decorator>....

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[TS 4.8] Deprecated factory methods aren't usable with originalNode.modifiers","articleBody":"# Bug Report\r\n\r\nDeprecated factory methods aren't usable with `originalNode.modifiers`.\r\n\r\n#49089 changed `Node.prototype.modifiers` from `NodeArray\u003cModifier>` to `NodeArray\u003cModifier | Decorator>`. It also changed factory functions to accept a single `NodeArray\u003cModifier | Decorator>` argument instead of separate modifiers and decorators arguments. The old factory functions are still available (they are deprecated now). But I imagine most usages of those old functions now result in a compile error for passing in `originalNode.modifiers`:\r\n\r\n> Argument of type 'NodeArray\u003cModifierLike>' is not assignable to parameter of type 'readonly Modifier[]'\r\n\r\n### 🔎 Search Terms\r\n\r\n4.8, modifiers, ModifiersArray, ModifierLike, decorators, Modifier, Decorator, factory\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 4.7.4 and 4.8-beta\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.7.4#code/JYWwDg9gTgLgBAKjgQwM5xugZlCI4BEMAnmAKaoDGUwYMBA3AFBNYCuAdpTMBBxlGQdUWaCADCAGzSoAImUqSAFNGABzAFwZUAOikz5i5IJ58AlHADeTOLbhQyMNlH6YdWZN2jEdbMABNkGDJ9VDkFaRNeDiUbO3jVNQAaOPjbRJ1-BWgg6FQUtLsMkAh-YCxgMih81LSMjmQQMgLCuAyScgAFY0bHKprWtpo1HQALKuAYZDUQ6TZUChbC4rIQACN+s2YAXyA)\r\n\r\nNote: Not sure how to reproduce this in the playground. `import from \"typescript\"` doesn't seem to import nightly typings in the playground.\r\n\r\n### 💻 Code\r\n\r\n```ts\r\nimport * as ts from \"typescript\";\r\n\r\nfunction transformClassDecl(orig: ts.ClassDeclaration) {\r\n    return ts.factory.updateClassDeclaration(\r\n        orig,\r\n        orig.decorators,\r\n        orig.modifiers,\r\n//      ^^^^^^^^^^^^^^ TS2345: Argument of type 'NodeArray\u003cModifierLike>' is not assignable to parameter of type 'readonly Modifier[]'.\r\n        orig.name,\r\n        orig.typeParameters,\r\n        orig.heritageClauses,\r\n        orig.members);\r\n}\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nThis code snippet fails to compile with the error message inlined in the snippet.\r\n\r\n### 🙂 Expected behavior\r\n\r\nIdeally the deprecated `factory.updateXxx` functions would still be usable as before. This would make the upgrade to TypeScript 4.8 easier.\r\n\r\nI imagine most usages pass in `originalNode.modifiers` unchanged, unless they modify the modifiers. Picking Angular as a random example:\r\n\r\nhttps://github.com/angular/angular/blob/557cf7dc63fe768900f296252e1a96e6166b24df/packages/compiler-cli/src/ngtsc/transform/src/transform.ts#L210\r\n\r\n### Workarounds\r\n\r\nWe can change usages of factory functions to make code compatible with both TypeScript 4.7 and 4.8 by doing something like:\r\n\r\n```ts\r\nts.factory.updateClassDeclaration(\r\n  orig,\r\n  orig.decorators,\r\n  orig.modifiers?.filter(ts.isModifier),\r\n  ...\r\n)\r\n```","author":{"url":"https://github.com/frigus02","@type":"Person","name":"frigus02"},"datePublished":"2022-07-18T12:53:15Z","url":"https://github.com/microsoft/TypeScript/issues/49939"}

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:cf7555e4-fa8f-331b-daa6-22cf093da7d0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9AF0:3F8AB1:74B65F:98569D:6B00D487
html-safe-nonce01d98aed4616fd594a6280b08ff545f44eb9d60fb4e87d300b649cd69773bf09
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUYwOjNGOEFCMTo3NEI2NUY6OTg1NjlEOjZCMDBENDg3IiwidmlzaXRvcl9pZCI6IjY3NTA1NTg4MDg1NDk5MzgzMTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac959720847d45097e44f6d5af16f1128fa56951a412f2848f2042fb987b0234c5
hovercard-subject-tagissue:1307915717
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/49939/issue_layout
twitter:imagehttps://opengraph.githubassets.com/65d82f13fec7576de603f1af0120ac7c70ff59bac20709d1b6dc3ecbee1297f6/microsoft/TypeScript/issues/49939
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/65d82f13fec7576de603f1af0120ac7c70ff59bac20709d1b6dc3ecbee1297f6/microsoft/TypeScript/issues/49939
og:image:altBug Report Deprecated factory methods aren't usable with originalNode.modifiers. #49089 changed Node.prototype.modifiers from NodeArray to NodeArray. It also changed...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefrigus02
hostnamegithub.com
expected-hostnamegithub.com
Nonea481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b
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
release84c8c5cc25e2fb7f2308428458538436baecc6d2
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/49939#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F49939
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%2F49939
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/49939
Reloadhttps://github.com/microsoft/TypeScript/issues/49939
Reloadhttps://github.com/microsoft/TypeScript/issues/49939
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/49939
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/49939
[TS 4.8] Deprecated factory methods aren't usable with originalNode.modifiershttps://github.com/microsoft/TypeScript/issues/49939#top
https://github.com/rbuckton
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.8.1https://github.com/microsoft/TypeScript/milestone/165
https://github.com/frigus02
Jan Kühle (frigus02)https://github.com/frigus02
on Jul 18, 2022https://github.com/microsoft/TypeScript/issues/49939#issue-1307915717
#49089https://github.com/microsoft/TypeScript/pull/49089
Playground link with relevant codehttps://www.typescriptlang.org/play?ts=4.7.4#code/JYWwDg9gTgLgBAKjgQwM5xugZlCI4BEMAnmAKaoDGUwYMBA3AFBNYCuAdpTMBBxlGQdUWaCADCAGzSoAImUqSAFNGABzAFwZUAOikz5i5IJ58AlHADeTOLbhQyMNlH6YdWZN2jEdbMABNkGDJ9VDkFaRNeDiUbO3jVNQAaOPjbRJ1-BWgg6FQUtLsMkAh-YCxgMih81LSMjmQQMgLCuAyScgAFY0bHKprWtpo1HQALKuAYZDUQ6TZUChbC4rIQACN+s2YAXyA
https://github.com/angular/angular/blob/557cf7dc63fe768900f296252e1a96e6166b24df/packages/compiler-cli/src/ngtsc/transform/src/transform.ts#L210https://github.com/angular/angular/blob/557cf7dc63fe768900f296252e1a96e6166b24df/packages/compiler-cli/src/ngtsc/transform/src/transform.ts#L210
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 Jul 29, 2022https://github.com/microsoft/TypeScript/issues/49939#event-7092198107
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Ron Buckton (rbuckton)https://github.com/rbuckton
on Jul 29, 2022https://github.com/microsoft/TypeScript/issues/49939#event-7092198327
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.8.1https://github.com/microsoft/TypeScript/milestone/165
on Jul 29, 2022https://github.com/microsoft/TypeScript/issues/49939#event-7092198532
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Aug 19, 2022https://github.com/microsoft/TypeScript/issues/49939#issuecomment-1220956123
#50343https://github.com/microsoft/TypeScript/pull/50343
https://github.com/frigus02
Jan Kühle (frigus02)https://github.com/frigus02
on Aug 22, 2022https://github.com/microsoft/TypeScript/issues/49939#issuecomment-1222126001
Jan Kühle (frigus02)https://github.com/frigus02
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 22, 2022https://github.com/microsoft/TypeScript/issues/49939#event-7231277281
https://github.com/frigus02
Jan Kühle (frigus02)https://github.com/frigus02
on Aug 22, 2022https://github.com/microsoft/TypeScript/issues/49939#issuecomment-1222246194
Ron Buckton (@rbuckton)https://github.com/rbuckton
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Aug 22, 2022https://github.com/microsoft/TypeScript/issues/49939#issuecomment-1222497413
Ron Buckton (@rbuckton)https://github.com/rbuckton
#50399https://github.com/microsoft/TypeScript/pull/50399
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/49939
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/49939
Ron Buckton (rbuckton)https://github.com/rbuckton
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.8.1https://github.com/microsoft/TypeScript/milestone/165
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.