-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Closed as not planned
Copy link
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
abstract readonly implementation
π Version & Regression Information
Tried in the playground on Nightly (v6.0.0-dev.20251002) and on v3.3.3333, there's no difference
β― Playground Link
π» Code
{
abstract class A {
abstract a: number; // Not readonly
}
// TypeScript doesn't care that this doesn't implement the setter
class B extends A {
get a() { return 1; } // Readonly
}
const l: A = new B();
l.a = 8; // No error (Reasonable)
}
{
abstract class A {
abstract readonly a: number; // Readonly
}
// TypeScript doesn't care that this doesn't implement the getter
class B extends A {
set a(v: number) { } // Writeonly
}
const l = new B();
l.a = 8; // No error (Good)
}
π Actual behavior
TypeScript only cares about the name of the implemented property and its type
π Expected behavior
It should also care about whether it's readable and/or writable
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created