René's URL Explorer Experiment


Title: TS2729 when a field initializer reads an inherited property redeclared with `declare` · Issue #65514 · microsoft/TypeScript · GitHub

Open Graph Title: TS2729 when a field initializer reads an inherited property redeclared with `declare` · Issue #65514 · microsoft/TypeScript

X Title: TS2729 when a field initializer reads an inherited property redeclared with `declare` · Issue #65514 · microsoft/TypeScript

Description: 🔎 Search Terms TS2729, used before its initialization, declare, useDefineForClassFields 🕗 Version & Regression Information This changed between versions 4.2.3 and 4.3.5 (#43194). It still reproduces in 6.0.3 and 7.1.0-dev.20261114.1. Fro...

Open Graph Description: 🔎 Search Terms TS2729, used before its initialization, declare, useDefineForClassFields 🕗 Version & Regression Information This changed between versions 4.2.3 and 4.3.5 (#43194). It still reproduce...

X Description: 🔎 Search Terms TS2729, used before its initialization, declare, useDefineForClassFields 🕗 Version & Regression Information This changed between versions 4.2.3 and 4.3.5 (#43194). It still repro...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TS2729 when a field initializer reads an inherited property redeclared with `declare`","articleBody":"### 🔎 Search Terms\n\nTS2729, used before its initialization, declare, useDefineForClassFields\n\n### 🕗 Version & Regression Information\n\n- This changed between versions 4.2.3 and 4.3.5 (#43194).\n- It still reproduces in 6.0.3 and `7.1.0-dev.20261114.1`. From 6.0 the default target enables `useDefineForClassFields`, so it reproduces with no options set.\n\n### ⏯ Playground Link\n\nhttps://www.typescriptlang.org/play/?useDefineForClassFields=true&target=99&ts=6.0.3#code/MYGwhgzhAEBCkFNoG8BQ0PQEYC5oDsBXAWywQCdoBeaARgG5UBfVVUSGABXAEt9oEADwAuCfABMY8CEjSZo46tGEALHhAB0WetAD0u6AHkA0s1bso0AHJhy5APYB3BIqGiJUxCnSZxCduRIuHTQAD7QAEyM8oo0qupaOvoCdvaUACoAyhEA7BEAnHicDgAOFMIAntAA5FjV0OrQhDKKZABmaUg8wjB83TxgIDwAXmDCPPb4GmZskxD2IAgaIPYA5gAU+AiO1rYOzuLrAJQa4kdJBrSoQA\n\n### 💻 Code\n\n(The Playground does not derive `useDefineForClassFields` from the target, so the link above enables it explicitly.)\n\n```ts\nclass Base {\n    b: number = 1;\n}\n\nclass Plain extends Base {\n    d = this.b; // OK\n}\n\nclass Narrowed extends Base {\n    declare b: 1 | 2;\n    d = this.b; // error TS2729: Property 'b' is used before its initialization.\n}\n\nconsole.log(new Narrowed().d); // 1\n```\n\n### 🙁 Actual behavior\n\n`this.b` in `Narrowed` reports TS2729.\n\n### 🙂 Expected behavior\n\nNo error, as in `Plain`. Per the spec, the base class's fields are initialized inside `super()`, and the derived class's fields right after `super()` returns ([SuperCall evaluation](https://tc39.es/ecma262/#sec-super-keyword-runtime-semantics-evaluation)). `declare` emits nothing, so `b` is already initialized (`1`) when `d` is initialized. #42319 also lists this as expected: \"`c` is allowed because of the `declare` modifier\".\n\n### Additional information about the issue\n\n- #43194 removed the ancestor-class exemption under `useDefineForClassFields`, for the case where a redeclaration without an initializer (`b;`) overwrites the property with `undefined` ([DefineField](https://tc39.es/ecma262/#sec-definefield)). It also catches `declare` redeclarations, which emit nothing. The test it added covers only the case without `declare`.\n- TS2612 suggests adding `declare` to such a redeclaration, and doing so produces this error.\n- The same error occurs with `declare context: React.ContextType\u003c…>`, as recommended by `@types/react`, when a field initializer reads `this.context`.\n- Found while testing my own TypeScript compiler (https://github.com/mizchi/ts.mbt).","author":{"url":"https://github.com/mizchi","@type":"Person","name":"mizchi"},"datePublished":"2026-11-15T14:29:33Z","url":"https://github.com/microsoft/TypeScript/issues/65514"}

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:6d328c2c-3dd4-852c-75e3-f751a1f86d35
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9A10:DB09F:67CB2C:85D42B:6B00E197
html-safe-nonce40db43f3f1d15ca9e9d497748e8b15ba143b3f2545a2bd92d7f3acd7c2e2a861
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTEwOkRCMDlGOjY3Q0IyQzo4NUQ0MkI6NkIwMEUxOTciLCJ2aXNpdG9yX2lkIjoiODkwNjY0MjMxNjgxMTM2MjcxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3ae69b6941f24136474fc882dca2315e3578d887bd4c7159752064b648d3b300
hovercard-subject-tagissue:6405203001
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/65514/issue_layout
twitter:imagehttps://opengraph.githubassets.com/24549159182038d3a6ae0575209044184b2481855850085c2214a00c5aee5377/microsoft/TypeScript/issues/65514
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/24549159182038d3a6ae0575209044184b2481855850085c2214a00c5aee5377/microsoft/TypeScript/issues/65514
og:image:alt🔎 Search Terms TS2729, used before its initialization, declare, useDefineForClassFields 🕗 Version & Regression Information This changed between versions 4.2.3 and 4.3.5 (#43194). It still reproduce...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemizchi
hostnamegithub.com
expected-hostnamegithub.com
None27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14
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
release624179fb8b88d26ba5bba08894eb60a1c5a1d93d
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/65514#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F65514
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%2F65514
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/65514
Reloadhttps://github.com/microsoft/TypeScript/issues/65514
Reloadhttps://github.com/microsoft/TypeScript/issues/65514
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/65514
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65514
TS2729 when a field initializer reads an inherited property redeclared with declarehttps://github.com/microsoft/TypeScript/issues/65514#top
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: classesBehavior of various `class` constructs, e.g. mixins or base classeshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20classes%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/mizchi
Kotaro Chikuba (mizchi)https://github.com/mizchi
on Nov 15, 2026https://github.com/microsoft/TypeScript/issues/65514#issue-6405203001
Consider class field properties to redeclare parent definitions #43194https://github.com/microsoft/TypeScript/pull/43194
https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=99&ts=6.0.3#code/MYGwhgzhAEBCkFNoG8BQ0PQEYC5oDsBXAWywQCdoBeaARgG5UBfVVUSGABXAEt9oEADwAuCfABMY8CEjSZo46tGEALHhAB0WetAD0u6AHkA0s1bso0AHJhy5APYB3BIqGiJUxCnSZxCduRIuHTQAD7QAEyM8oo0qupaOvoCdvaUACoAyhEA7BEAnHicDgAOFMIAntAA5FjV0OrQhDKKZABmaUg8wjB83TxgIDwAXmDCPPb4GmZskxD2IAgaIPYA5gAU+AiO1rYOzuLrAJQa4kdJBrSoQAhttps://www.typescriptlang.org/play/?useDefineForClassFields=true&target=99&ts=6.0.3#code/MYGwhgzhAEBCkFNoG8BQ0PQEYC5oDsBXAWywQCdoBeaARgG5UBfVVUSGABXAEt9oEADwAuCfABMY8CEjSZo46tGEALHhAB0WetAD0u6AHkA0s1bso0AHJhy5APYB3BIqGiJUxCnSZxCduRIuHTQAD7QAEyM8oo0qupaOvoCdvaUACoAyhEA7BEAnHicDgAOFMIAntAA5FjV0OrQhDKKZABmaUg8wjB83TxgIDwAXmDCPPb4GmZskxD2IAgaIPYA5gAU+AiO1rYOzuLrAJQa4kdJBrSoQA
SuperCall evaluationhttps://tc39.es/ecma262/#sec-super-keyword-runtime-semantics-evaluation
#42319https://github.com/microsoft/TypeScript/issues/42319
Consider class field properties to redeclare parent definitions #43194https://github.com/microsoft/TypeScript/pull/43194
DefineFieldhttps://tc39.es/ecma262/#sec-definefield
https://github.com/mizchi/ts.mbthttps://github.com/mizchi/ts.mbt
Kotaro Chikuba (mizchi)https://github.com/mizchi
on Nov 15, 2026https://github.com/microsoft/TypeScript/issues/65514#event-36194965478
tsc-extra: record the filed issue for the declare-field casehttps://github.com/mizchi/ts.mbt/commit/ee3f96534b249807a99e342867f11f28ff87b833
ee3f965https://github.com/mizchi/ts.mbt/commit/ee3f96534b249807a99e342867f11f28ff87b833
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: classesBehavior of various `class` constructs, e.g. mixins or base classeshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20classes%22
on Nov 17, 2026https://github.com/microsoft/TypeScript/issues/65514#event-36431359756
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Nov 17, 2026https://github.com/microsoft/TypeScript/issues/65514#event-36431373119
5 (tydavid5)https://github.com/tydavid5
on Nov 19, 2026https://github.com/microsoft/TypeScript/issues/65514#event-36641990335
Allow declare redeclarations of inherited properties in field initial…https://github.com/tydavid5/TypeScript/commit/7791e4a48d0bdd982f0184f7fc14545a4e980b9d
https://docs.github.com/articles/closing-issues-via-commit-messages
7791e4ahttps://github.com/tydavid5/TypeScript/commit/7791e4a48d0bdd982f0184f7fc14545a4e980b9d
Restrict the declare exemption to ambient instance propertieshttps://github.com/tydavid5/TypeScript/commit/ec9efde51eb5a7203793a285b0bfed80aa074ecf
https://docs.github.com/articles/closing-issues-via-commit-messages
ec9efdehttps://github.com/tydavid5/TypeScript/commit/ec9efde51eb5a7203793a285b0bfed80aa074ecf
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/65514
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/65514
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: classesBehavior of various `class` constructs, e.g. mixins or base classeshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20classes%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.