Closed
Description
Code
"use strict";
class A
{
constructor(public id: string)
{}
}
class B extends A
{
public get id() { return this._innerId;}
private _innerId: string;
constructor(id: string)
{
super(id);
this._innerId = id;
}
}
try
{
new B("id2")
alert("Erfolg")
}
catch(e)
{
alert(e);
}
Expected behavior:
superclass A has a public property "id" which is set in the constructor.
subclass B is derived from A, but has a getter on an own property "id".
I expected that the compiler detects the name conflict between the public properties "id" in A and B respectively.
Actual behavior:
The typescript compiler generates javascript. When the code is executed, the javascript runtime throws an exception stating that the property "id" of the subclass cannot be set.
Related Issues: