🔎 Search Terms
private, protected
🕗 Version & Regression Information
Version 5.6.2
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAYwDYEMDOa4DEITgbwChC5S4woIZgFqATOGACwEs0BJNABUutuAYBeOAEYA3CTIUWANxTVGrDtyiz5wOMPHEycAEYooACgCUALhx4iu3QggA7NPGbzNithJtlJXqMBgArlD2cPbAAO6IqBhwoNT2dJiWBDpeNmgQALb+rPYA5qYpacVwfoHBivIAdMxsnDxqCgDUlTA1SvW8NPSeJaQAvj42g7qD-UA
💻 Code
export class Foo {
protected thisIsProtected = 1;
private thisIsPrivate = 1;
bar():Foo {
const that = this;
return new class extends Foo {
something() {
return that.thisIsPrivate + that.thisIsProtected;
}
}
}
}
🙁 Actual behavior
I get a compile error for that.thisIsProtected, but not for that.thisIsPrivate
🙂 Expected behavior
I can access the protected field, like the private
Additional information about the issue
No response
🔎 Search Terms
private, protected
🕗 Version & Regression Information
Version 5.6.2
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAYwDYEMDOa4DEITgbwChC5S4woIZgFqATOGACwEs0BJNABUutuAYBeOAEYA3CTIUWANxTVGrDtyiz5wOMPHEycAEYooACgCUALhx4iu3QggA7NPGbzNithJtlJXqMBgArlD2cPbAAO6IqBhwoNT2dJiWBDpeNmgQALb+rPYA5qYpacVwfoHBivIAdMxsnDxqCgDUlTA1SvW8NPSeJaQAvj42g7qD-UA
💻 Code
🙁 Actual behavior
I get a compile error for
that.thisIsProtected, but not forthat.thisIsPrivate🙂 Expected behavior
I can access the protected field, like the private
Additional information about the issue
No response