-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InterfaceDeclarationStructure has no get or set accessors #1431
Comments
I can already see there would be a lot to build out.
I think briefly about taking this on, but this would be a big chunk of time when I don't have much to spare. I'm writing this comment as a brainstorm attempt at a roadmap, and I'm wondering what I'm missing. |
I have a need for this, so I might collaborate with you on this; i'll let you know if I start on it @ajvincent |
@forivall Sweet. It's always nice to have a motivated collaborator. I would be quite happy if you took the lead on this. For me, this is more of an annoyance / future need rather than an immediate need. I do have a current clean fork of this repository already, and branches are cheap... so I could invite you as a collaborator there if you'd prefer to use my fork. I did discover one missed part in my checklist earlier, a few days ago:
Of course, I would still like to get a review of the roadmap to see what else we missed before we dive in too deep. |
@forivall I might start on this very soon. That "future need" is getting close. My need is for a "type-to-class" functionality (more accurately a "membered-type-to-class"), and I'm envisioning having the getters and setters defined on the interface before I start running. This would be nicer than modifying the type inside the class builder. |
@dsherret I am formally asking for a design review per CONTRIBUTING.md. If we do not have enough details here for a proper design, please say so and point me to a good example design you've approved in the past. I want to move forward as soon as practical. |
Adding this sounds good! I think it should be fairly straightforward, but a bit of work. |
@forivall https://github.com/ajvincent/ts-morph/tree/interface-getters-setters just starting out. |
I've just hit the first of probably many stumbling blocks. (I've been busy the last few weeks.) Specifically, I'm looking at building I started by trying to figure out what I need to add to The stumbling block is the So I end up with: getGetAccessorSignatures() /* : GetAccessorDeclaration[] */{
return this.compilerNode.members.filter(m => m.kind === SyntaxKind.GetAccessor)
.map(m => this._getNodeFromCompilerNode(m as ts.GetAccessorDeclaration))
}
So if I can reuse the existing @dsherret advice please? |
@ajvincent would you be able to open a PR with what you've done so far? I'm going to do a major release of ts-morph this weekend probably and can finish this up in case it's not done by then. It should use GetAccessorDeclaration (see how they're the same here) and not a new node type. GetAccessorDeclaration already has an optional body (it's a BodyableNode and not a BodiedNode). Also see ts-morph/packages/ts-morph/src/structurePrinters/class/GetAccessorDeclarationStructurePrinter.ts Line 28 in a90dc91
Thanks for working on this! |
You are most welcome, though I think you'll find I didn't get very deep into this - and I wish I had. I'm pretty good about writing tests and documentation... and I'd be happy to write a follow-up PR for those purposes. |
@dsherret where do we stand on this? I've been battling an illness this week, though it seems to be fading. I'm willing to pick this up again so you can ship the next version of ts-morph without it, if you so desire. |
@ajvincent I'll finish it up right now. I was too busy throughout the week to do it. Hope you feel better soon! |
Describe the bug
Version: 19.0.0
To Reproduce
ts-ast-viewer link
Expected behavior
I wanted to see the get accessor for
A
in the output structure.I believe the fault is in
TypeElementMemberedNodeStructure
. It lists methods and properties but not get accessors or set accessors.The text was updated successfully, but these errors were encountered: