You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classBase{};// No base class, type parameter with same name - WorksexportclassC1<T>{T: number;constructor(T: number){this.T=T;}}// Base class, type parameter with same name - Doesn't workexportclassC2<T>extendsBase{T: number;constructor(T: number){super();this.T=T;// Property 'T' does not exist on type 'C2<T>'.(2339)}}
🙁 Actual behavior
Property 'T' does not exist on type 'C2<T>'.(2339)
TypeScript does not recognize property T on class C2 but no issue on class C1.
🙂 Expected behavior
No type error, property should be found as expected for both C1 and C2.
Additional information about the issue
This is not an issue if the class does not extend another class, or if the type parameter does not match the property. The property is also not defined on the parent class.
The text was updated successfully, but these errors were encountered:
@molisani do you have a reasonable workaround on your end, or do you need a 5.3 patch?
This only affects one of our projects and changing either the property name or the type parameter resolves it for now so I don't think an immediate patch is necessary.
🔎 Search Terms
ts2339, "property does not exist on type", "property matches type parameter"
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.2#code/MYGwhgzhAEBCkFNoG8C+BuAUJg9D6AcgPbQBGi0okEANNAC4CeADks2AE5gC2C9CHaAHcAlvQAW0CDyQA7GdAC00AOpEOAawiYEAD2br6lcFGgBhAIwAeACoA+FJmjPoNgFzRZAV26kBWF0oiWQh6Di9genUACndPHz8OAEpHQMCJEQgAOhtoAF5XAJdUTBLcfHgIJCooOiZWaHYuXn5BUQkpBXleJWgAESIECFkAciMhdQ0dfUNjanMAJlsHPX5ZABMYSqRkJxc4719-PedgYNDwyJiDhIEU3bSXCC9WDmikoseM7NyCm0-oCUSkA
💻 Code
🙁 Actual behavior
Property 'T' does not exist on type 'C2<T>'.(2339)
TypeScript does not recognize property
T
on classC2
but no issue on classC1
.🙂 Expected behavior
No type error, property should be found as expected for both
C1
andC2
.Additional information about the issue
This is not an issue if the class does not extend another class, or if the type parameter does not match the property. The property is also not defined on the parent class.
The text was updated successfully, but these errors were encountered: