Last active
August 7, 2020 01:56
-
-
Save swyxio/21ca6ad7f582c4a1a191f4835d8c2553 to your computer and use it in GitHub Desktop.
types for estree with JSX - the default estree types (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/estree/index.d.ts) dont come with JSX definitions so i made a short start on them. pls comment if you have more to add
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Location { | |
start: number; | |
end: number; | |
}; | |
interface JSXOpeningElement extends Location { | |
type: 'JSXOpeningElement', | |
attributes: JSXAttribute[], | |
name: JSXIdentifier, | |
selfClosing: boolean | |
} | |
interface JSXClosingElement extends Location { | |
type: 'JSXClosingElement' | |
name: JSXIdentifier | |
} | |
interface JSXElement extends Location { | |
type: 'JSXElement', | |
attributes: JSXAttribute[], | |
openingElement: JSXOpeningElement | |
closingElement: JSXClosingElement | |
children: (JSXElement | JSXText)[] | |
} | |
interface JSXText extends Location { | |
type: 'JSXText' | |
value: string, | |
raw: string | |
} | |
interface JSXAttribute extends Location { | |
type: 'JSXAttribute', | |
name: JSXNamespacedName | JSXIdentifier, | |
value: JSXExpressionContainer | Literal | |
} | |
interface JSXIdentifier extends Location { | |
type: 'JSXIdentifier' | |
name: string | |
} | |
interface JSXNamespacedName extends Location { | |
type: 'JSXNamespacedName', | |
namespace: JSXIdentifier, | |
name: JSXIdentifier | |
} | |
interface JSXExpressionContainer extends Location { | |
type: 'JSXExpressionContainer' | |
expression: Identifier | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment