-
-
Notifications
You must be signed in to change notification settings - Fork 74
Should Interfaces be converted? #201
Comments
I agree that we should have a TS prefix for all interface node types. There might be a benefit in the future to use the same names as flow, like sharing eslint rule, but I do not see one currently. I do think we should use a body property inside of the TSInterfaceDeclaration as this seems to fit with the estree style. I also think then it would make sense to have a body property inside of TSInterfaceBody. Babel/Flow uses properties and Typescript uses members but ESTree uses body for class properties and I think that makes sense here. So in summary:
I will try and spend some time and write up more documentation on the estree variant we produce as it is hard to track without reading the code. @Pajn @JamesHenry |
What goes in interface bodies are very similar (or even the same?) as what goes into TypeLiters/Object types. So I think wrapping properties should be either done for both or none to avoid having two different structures for very similar code. |
Are you saying we should not use |
Sorry I got a bit confused, it was |
Yes I believe we should have several node types in an Maybe we should not use the name So to clean up what I had above:
Thoughts? |
That looks great! |
Yes I can create a PR for this, unless you have some time available. |
Take it if you want, but otherwise I should be able to get to it sometime this week. |
I'm going to implement this today. I some free time |
This commit create an TSInterfaceDeclration and TSInterfaceBody node when converting typescript interface
This commit create an TSInterfaceDeclration and TSInterfaceBody node when converting typescript interface
This commit create an TSInterfaceDeclration and TSInterfaceBody node when converting typescript interface
I have started implementing support for interfaces in prettier but as the TS AST is a bit different than the ESTree it does not integrate as nice as other features have so far.
Flow does use
ObjectTypeAnnotation
for the body of the interface, similarly to how classes have aClassBody
node.As the interface bodies can be quite different from my understanding (TS support a lot of (strange?) syntax in them). It might be best to keep TS prefixes on the type name even if we do this.
Just opening this for discussion, the current format is completely workable but it might at least be worth considering.
The text was updated successfully, but these errors were encountered: