-
Notifications
You must be signed in to change notification settings - Fork 133
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
Add proposed fragment changes #93
Changes from 1 commit
aac60d5
448fea4
f317675
a3bd36d
62bd1f9
6bf1219
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,12 +73,13 @@ Any JSX element is bounded by tags — either self-closing or both opening a | |
```js | ||
interface JSXBoundaryElement <: Node { | ||
name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName; | ||
isFragment: boolean; | ||
} | ||
|
||
interface JSXOpeningElement <: JSXBoundaryElement { | ||
type: "JSXOpeningElement", | ||
attributes: [ JSXAttribute | JSXSpreadAttribute ], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This type is also not describing the constraints since attributes will always be an empty array. |
||
selfClosing: boolean; | ||
selfClosing: boolean; // if this is true, isFragment must be false, and vice-versa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is not fully describing the type constraints. It's just ad-hoc. Declaring a new interface will avoid that problem. |
||
} | ||
|
||
interface JSXClosingElement <: JSXBoundaryElement { | ||
|
@@ -133,7 +134,8 @@ interface JSXElement <: Expression { | |
type: "JSXElement", | ||
openingElement: JSXOpeningElement, | ||
children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement ], | ||
closingElement: JSXClosingElement | null | ||
closingElement: JSXClosingElement | null, | ||
isFragment: boolean; | ||
} | ||
``` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type annotation is now incorrect or you need to describe what should be in here since fragments don't have an identifier nor member expression nor namespace name.
If
isFragment
is true this is alwaysnull
, ifisFragment
is false then this is always not-null
.That's an indication that this shouldn't use a flag but its own interface.