ts-morph icon indicating copy to clipboard operation
ts-morph copied to clipboard

ClassDeclarationStructure has no support for static block structures

Open ajvincent opened this issue 1 year ago • 0 comments

Describe the bug

Version: 21.0.1

I discovered this tonight, realizing we can't actually get any ClassStaticBlockDeclarationStructure objects via ClassDeclarationNode.prototype.getStructure(). This is one of a few structure types unreachable from a sourceFile.getStructure() call.

To Reproduce

class Foo {
    static x: number;
    static {
        this.x = 0;
    }
}

ts-ast-viewer link

Expected behavior

I'd like to call classDeclaration.getStructure() and get any static blocks via a field on the ClassDeclarationStructure.

Note: I don't have a need for this. I'm filing this for completeness.

ajvincent avatar Jan 13 '24 04:01 ajvincent