Property is not assignable to the same property in generic base type
#61,918 opened on 2025幎6æ23æ¥
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
Property is not assignable to the same property in generic base type
ð Version & Regression Information
-This is the behavior in every version I tried, and I reviewed
⯠Playground Link
ð» Code
abstract class Rho {
abstract pidgins<F_E extends number, F_J>(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins<F_E extends number, F_J>(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}
ð Actual behavior
Property 'pidgins' in type 'Bluffer' is not assignable to the same property in base type 'Rho'. Type '<F_E extends number, F_J>(brusquest: F_E | F_J) => F_E | F_J' is not assignable to type '<F_E extends number, F_J>(brusquest: F_E | F_J) => F_E | F_J'. Two different types with this name exist, but they are unrelated. Type 'number | F_E | F_J' is not assignable to type 'F_E | F_J'. Type 'number' is not assignable to type 'F_E | F_J'.(2416)
ð Expected behavior
No error
Additional information about the issue
The following works with no error:
abstract class Rho {
abstract pidgins<F_E extends number, F_J>(brusquest: F_J | F_E): F_J | F_E;
abstract pidgins<F_E extends number, F_J>(brusquest: F_J | F_E): F_J | F_E;
}
class Bluffer extends Rho {
pidgins<F_E extends number, F_J>(brusquest: F_J | F_E): F_J | F_E
{
return brusquest;
}
}