%% generate tags start %% #software-engineering %% generate tags end %% #software-engineering/typescript ```javascript class Foo { static Bar = class { } } // works! var foo = new Foo(); var bar = new Foo.Bar(); ``` but nested class cannot have protected and privated member. ![](https://res.cloudinary.com/yomaru/image/upload/v1703626888/obsidian/zneqhtgfzu56sc8c4wcy.webp) it looks like this work: ```ts class Baz { baz = 1; } class Foo { private Bar = class extends Baz{ } } ``` > [!warning] Be aware that doing this means that you create a different class Bar for each instance of Foo.