hydra.type_script.syntax module
A TypeScript 5.x syntax model for Hydra code generation.
- class hydra.type_script.syntax.ArrayElement
Bases:
objectArrayElementExpression | ArrayElementSpread | ArrayElementHole
- EXPRESSION = Name(value='expression')
- HOLE = Name(value='hole')
- SPREAD = Name(value='spread')
- TYPE_ = Name(value='hydra.typeScript.syntax.ArrayElement')
- class hydra.type_script.syntax.ArrayElementExpression(value: T)
Bases:
Node[Expression]A regular expression element
- class hydra.type_script.syntax.ArrayElementHole
Bases:
objectAn empty slot (elision)
- class hydra.type_script.syntax.ArrayElementSpread(value: T)
Bases:
Node[SpreadElement]A spread element …x
- class hydra.type_script.syntax.ArrayTypeExpression(value: T)
Bases:
Node[TypeExpression]An array type (T[]).
- TYPE_ = Name(value='hydra.typeScript.syntax.ArrayTypeExpression')
- class hydra.type_script.syntax.ArrowFunctionBody
Bases:
objectArrowFunctionBodyExpression | ArrowFunctionBodyBlock
- BLOCK = Name(value='block')
- EXPRESSION = Name(value='expression')
- TYPE_ = Name(value='hydra.typeScript.syntax.ArrowFunctionBody')
- class hydra.type_script.syntax.ArrowFunctionBodyExpression(value: T)
Bases:
Node[Expression]
- class hydra.type_script.syntax.ArrowFunctionExpression(params: Annotated[Sequence[Pattern], 'Function parameters'], body: Annotated[ArrowFunctionBody, 'Function body (expression or block)'], async_: Annotated[bool, 'Whether the function is async'])
Bases:
objectAn arrow function expression.
- ASYNC = Name(value='async')
- BODY = Name(value='body')
- class Builder(_params: 'Sequence[Pattern]' = None, _body: 'ArrowFunctionBody' = None, _async_: 'bool' = None)
Bases:
object- async_(async_)
- body(body)
- build()
- params(params)
- PARAMS = Name(value='params')
- TYPE_ = Name(value='hydra.typeScript.syntax.ArrowFunctionExpression')
- async_: Annotated[bool, 'Whether the function is async']
- body: Annotated[ArrowFunctionBody, 'Function body (expression or block)']
- static builder()
- with_async_(async_)
- with_body(body)
- with_params(params)
- class hydra.type_script.syntax.AsExpression(expression: Annotated[Expression, 'The expression being cast'], type: Annotated[TypeExpression, 'The target type'])
Bases:
objectA TypeScript <expression> as <type> cast.
- class Builder(_expression: 'Expression' = None, _type: 'TypeExpression' = None)
Bases:
object- build()
- expression(expression)
- type(type)
- EXPRESSION = Name(value='expression')
- TYPE = Name(value='type')
- TYPE_ = Name(value='hydra.typeScript.syntax.AsExpression')
- static builder()
- expression: Annotated[Expression, 'The expression being cast']
- type: Annotated[TypeExpression, 'The target type']
- with_expression(expression)
- with_type(type)
- class hydra.type_script.syntax.AssignmentExpression(operator: AssignmentOperator, left: Pattern, right: Expression)
Bases:
objectAn assignment expression.
- class Builder(_operator: 'AssignmentOperator' = None, _left: 'Pattern' = None, _right: 'Expression' = None)
Bases:
object- build()
- left(left)
- operator(operator)
- right(right)
- LEFT = Name(value='left')
- OPERATOR = Name(value='operator')
- RIGHT = Name(value='right')
- TYPE_ = Name(value='hydra.typeScript.syntax.AssignmentExpression')
- static builder()
- operator: AssignmentOperator
- right: Expression
- with_left(left)
- with_operator(operator)
- with_right(right)
- class hydra.type_script.syntax.AssignmentOperator(*values)
Bases:
EnumAn assignment operator.
- ADD_ASSIGN = Name(value='addAssign')
+=
- AND_ASSIGN = Name(value='andAssign')
&&=
- ASSIGN = Name(value='assign')
=
- BITWISE_AND_ASSIGN = Name(value='bitwiseAndAssign')
&=
- BITWISE_XOR_ASSIGN = Name(value='bitwiseXorAssign')
^=
- DIVIDE_ASSIGN = Name(value='divideAssign')
/=
- LEFT_SHIFT_ASSIGN = Name(value='leftShiftAssign')
<<=
- MODULO_ASSIGN = Name(value='moduloAssign')
%=
- NULLISH_ASSIGN = Name(value='nullishAssign')
??=
- OR_ASSIGN = Name(value='orAssign')
||=
- RIGHT_SHIFT_ASSIGN = Name(value='rightShiftAssign')
>>=
- SUBTRACT_ASSIGN = Name(value='subtractAssign')
-=
- TYPE_ = Name(value='hydra.typeScript.syntax.AssignmentOperator')
- UNSIGNED_RIGHT_SHIFT_ASSIGN = Name(value='unsignedRightShiftAssign')
>>>=
- class hydra.type_script.syntax.AssignmentPattern(left: Pattern, right: Expression)
Bases:
objectA pattern with default value (param = default).
- class Builder(_left: 'Pattern' = None, _right: 'Expression' = None)
Bases:
object- build()
- left(left)
- right(right)
- LEFT = Name(value='left')
- RIGHT = Name(value='right')
- TYPE_ = Name(value='hydra.typeScript.syntax.AssignmentPattern')
- static builder()
- right: Expression
- with_left(left)
- with_right(right)
- class hydra.type_script.syntax.BinaryExpression(operator: BinaryOperator, left: Expression, right: Expression)
Bases:
objectA binary operation expression.
- class Builder(_operator: 'BinaryOperator' = None, _left: 'Expression' = None, _right: 'Expression' = None)
Bases:
object- build()
- left(left)
- operator(operator)
- right(right)
- LEFT = Name(value='left')
- OPERATOR = Name(value='operator')
- RIGHT = Name(value='right')
- TYPE_ = Name(value='hydra.typeScript.syntax.BinaryExpression')
- static builder()
- left: Expression
- operator: BinaryOperator
- right: Expression
- with_left(left)
- with_operator(operator)
- with_right(right)
- class hydra.type_script.syntax.BinaryOperator(*values)
Bases:
EnumA binary operator.
- ADD = Name(value='add')
- AND = Name(value='and')
&&
- BITWISE_AND = Name(value='bitwiseAnd')
&
- BITWISE_OR = Name(value='bitwiseOr')
- BITWISE_XOR = Name(value='bitwiseXor')
^
- DIVIDE = Name(value='divide')
/
- EQUAL = Name(value='equal')
==
- GREATER_THAN = Name(value='greaterThan')
>
- GREATER_THAN_OR_EQUAL = Name(value='greaterThanOrEqual')
>=
- IN = Name(value='in')
in
- INSTANCEOF = Name(value='instanceof')
instanceof
- LEFT_SHIFT = Name(value='leftShift')
<<
- LESS_THAN = Name(value='lessThan')
<
- LESS_THAN_OR_EQUAL = Name(value='lessThanOrEqual')
<=
- MODULO = Name(value='modulo')
%
- MULTIPLY = Name(value='multiply')
- NOT_EQUAL = Name(value='notEqual')
!=
- NULLISH_COALESCING = Name(value='nullishCoalescing')
??
- OR = Name(value='or')
||
- RIGHT_SHIFT = Name(value='rightShift')
>>
- STRICT_EQUAL = Name(value='strictEqual')
===
- STRICT_NOT_EQUAL = Name(value='strictNotEqual')
!==
- SUBTRACT = Name(value='subtract')
- TYPE_ = Name(value='hydra.typeScript.syntax.BinaryOperator')
- UNSIGNED_RIGHT_SHIFT = Name(value='unsignedRightShift')
>>>
- class hydra.type_script.syntax.CallExpression(callee: Annotated[Expression, 'The function being called'], arguments: Annotated[Sequence[Expression], 'The arguments'], optional: Annotated[bool, 'Whether using optional chaining (?.)'])
Bases:
objectA function call expression.
- ARGUMENTS = Name(value='arguments')
- class Builder(_callee: 'Expression' = None, _arguments: 'Sequence[Expression]' = None, _optional: 'bool' = None)
Bases:
object- arguments(arguments)
- build()
- callee(callee)
- optional(optional)
- CALLEE = Name(value='callee')
- OPTIONAL = Name(value='optional')
- TYPE_ = Name(value='hydra.typeScript.syntax.CallExpression')
- arguments: Annotated[Sequence[Expression], 'The arguments']
- static builder()
- callee: Annotated[Expression, 'The function being called']
- optional: Annotated[bool, 'Whether using optional chaining (?.)']
- with_arguments(arguments)
- with_callee(callee)
- with_optional(optional)
- class hydra.type_script.syntax.CatchClause(param: Annotated[object, 'The catch parameter (can be omitted in ES2019+)'], body: Sequence[Statement])
Bases:
objectA catch clause.
- BODY = Name(value='body')
- class Builder(_param: 'Optional[Pattern]' = None, _body: 'BlockStatement' = None)
Bases:
object- body(body)
- build()
- param(param)
- PARAM = Name(value='param')
- TYPE_ = Name(value='hydra.typeScript.syntax.CatchClause')
- static builder()
- with_body(body)
- with_param(param)
- class hydra.type_script.syntax.ClassDeclaration(id: Annotated[Identifier, 'Class name'], super_class: Annotated[object, 'Optional superclass'], body: Annotated[Sequence[MethodDefinition], 'Class body'])
Bases:
objectA class declaration.
- BODY = Name(value='body')
- class Builder(_id: 'Identifier' = None, _super_class: 'Optional[Expression]' = None, _body: 'ClassBody' = None)
Bases:
object- body(body)
- build()
- id(id)
- super_class(super_class)
- ID = Name(value='id')
- SUPER_CLASS = Name(value='superClass')
- TYPE_ = Name(value='hydra.typeScript.syntax.ClassDeclaration')
- body: Annotated[Sequence[MethodDefinition], 'Class body']
- static builder()
- id: Annotated[Identifier, 'Class name']
- with_body(body)
- with_id(id)
- with_super_class(super_class)
- class hydra.type_script.syntax.ClassDeclarationWithComments(body: Annotated[ClassDeclaration, 'The class declaration'], comments: Annotated[object, 'Optional JSDoc comment'])
Bases:
objectA class declaration with optional JSDoc.
- BODY = Name(value='body')
- class Builder(_body: 'ClassDeclaration' = None, _comments: 'Optional[DocumentationComment]' = None)
Bases:
object- body(body)
- build()
- comments(comments)
- COMMENTS = Name(value='comments')
- TYPE_ = Name(value='hydra.typeScript.syntax.ClassDeclarationWithComments')
- body: Annotated[ClassDeclaration, 'The class declaration']
- static builder()
- with_body(body)
- with_comments(comments)
- class hydra.type_script.syntax.Comment
Bases:
objectCommentLine | CommentBlock | CommentDocumentation
- BLOCK = Name(value='block')
- DOCUMENTATION = Name(value='documentation')
- LINE = Name(value='line')
- TYPE_ = Name(value='hydra.typeScript.syntax.Comment')
- class hydra.type_script.syntax.CommentBlock(value: T)
Bases:
Node[str]A block comment, delimited by slash-star and star-slash
- class hydra.type_script.syntax.CommentDocumentation(value: T)
Bases:
Node[DocumentationComment]A documentation comment, delimited by slash-double-star and star-slash (JSDoc)
- class hydra.type_script.syntax.ConditionalExpression(test: Expression, consequent: Expression, alternate: Expression)
Bases:
objectA conditional (ternary) expression: test ? consequent : alternate.
- ALTERNATE = Name(value='alternate')
- class Builder(_test: 'Expression' = None, _consequent: 'Expression' = None, _alternate: 'Expression' = None)
Bases:
object- alternate(alternate)
- build()
- consequent(consequent)
- test(test)
- CONSEQUENT = Name(value='consequent')
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.ConditionalExpression')
- alternate: Expression
- static builder()
- consequent: Expression
- test: Expression
- with_alternate(alternate)
- with_consequent(consequent)
- with_test(test)
- class hydra.type_script.syntax.DoWhileStatement(body: Statement, test: Expression)
Bases:
objectA do-while statement.
- BODY = Name(value='body')
- class Builder(_body: 'Statement' = None, _test: 'Expression' = None)
Bases:
object- body(body)
- build()
- test(test)
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.DoWhileStatement')
- static builder()
- test: Expression
- with_body(body)
- with_test(test)
- class hydra.type_script.syntax.DocumentationComment(description: Annotated[str, 'The main description'], tags: Annotated[Sequence[DocumentationTag], 'Documentation tags (@param, @returns, etc.)'])
Bases:
objectA documentation comment (JSDoc) with structured tags.
- class Builder(_description: 'str' = None, _tags: 'Sequence[DocumentationTag]' = None)
Bases:
object- build()
- description(description)
- tags(tags)
- DESCRIPTION = Name(value='description')
- TAGS = Name(value='tags')
- TYPE_ = Name(value='hydra.typeScript.syntax.DocumentationComment')
- static builder()
- description: Annotated[str, 'The main description']
- tags: Annotated[Sequence[DocumentationTag], 'Documentation tags (@param, @returns, etc.)']
- with_description(description)
- with_tags(tags)
- class hydra.type_script.syntax.DocumentationTag(name: Annotated[str, 'Tag name (param, returns, type, etc.)'], type: Annotated[object, 'Optional type expression'], param_name: Annotated[object, 'Optional parameter name (for @param)'], description: Annotated[str, 'Tag description'])
Bases:
objectA documentation tag (@param, @returns, @type, etc.).
- class Builder(_name: 'str' = None, _type: 'Optional[TypeExpression]' = None, _param_name: 'Optional[Identifier]' = None, _description: 'str' = None)
Bases:
object- build()
- description(description)
- name(name)
- param_name(param_name)
- type(type)
- DESCRIPTION = Name(value='description')
- NAME = Name(value='name')
- PARAM_NAME = Name(value='paramName')
- TYPE = Name(value='type')
- TYPE_ = Name(value='hydra.typeScript.syntax.DocumentationTag')
- static builder()
- description: Annotated[str, 'Tag description']
- name: Annotated[str, 'Tag name (param, returns, type, etc.)']
- with_description(description)
- with_name(name)
- with_param_name(param_name)
- with_type(type)
- class hydra.type_script.syntax.ExportAllDeclaration(exported: object, source: StringLiteral)
Bases:
objectExport all declaration (export * from …).
- class Builder(_exported: 'Optional[Identifier]' = None, _source: 'StringLiteral' = None)
Bases:
object- build()
- exported(exported)
- source(source)
- EXPORTED = Name(value='exported')
- SOURCE = Name(value='source')
- TYPE_ = Name(value='hydra.typeScript.syntax.ExportAllDeclaration')
- static builder()
- source: StringLiteral
- with_exported(exported)
- with_source(source)
- class hydra.type_script.syntax.ExportDeclaration
Bases:
objectExportDeclarationNamed | ExportDeclarationDefault | ExportDeclarationDeclaration | ExportDeclarationAll
- ALL = Name(value='all')
- DECLARATION = Name(value='declaration')
- DEFAULT = Name(value='default')
- NAMED = Name(value='named')
- TYPE_ = Name(value='hydra.typeScript.syntax.ExportDeclaration')
- class hydra.type_script.syntax.ExportDeclarationAll(value: T)
Bases:
Node[ExportAllDeclaration]Export all (export * from …)
- class hydra.type_script.syntax.ExportDeclarationDeclaration(value: T)
-
Export a declaration (export const x = …)
- class hydra.type_script.syntax.ExportDeclarationDefault(value: T)
Bases:
Node[Expression]Default export (export default …)
- class hydra.type_script.syntax.ExportDeclarationNamed(value: T)
Bases:
Node[NamedExport]Named exports (export {x, y as z})
- class hydra.type_script.syntax.ExportSpecifier(local: Identifier, exported: Identifier)
Bases:
objectAn export specifier (x as y).
- class Builder(_local: 'Identifier' = None, _exported: 'Identifier' = None)
Bases:
object- build()
- exported(exported)
- local(local)
- EXPORTED = Name(value='exported')
- LOCAL = Name(value='local')
- TYPE_ = Name(value='hydra.typeScript.syntax.ExportSpecifier')
- static builder()
- exported: Identifier
- local: Identifier
- with_exported(exported)
- with_local(local)
- class hydra.type_script.syntax.Expression
Bases:
objectExpressionIdentifier | ExpressionLiteral | ExpressionArray | ExpressionObject | ExpressionFunction | ExpressionArrow | ExpressionCall | ExpressionMember | ExpressionConditional | ExpressionBinary | ExpressionUnary | ExpressionAssignment | ExpressionSequence | ExpressionThis | ExpressionNew | ExpressionYield | ExpressionAwait | ExpressionSpread | ExpressionParenthesized | ExpressionAsExpression
- ARRAY = Name(value='array')
- ARROW = Name(value='arrow')
- ASSIGNMENT = Name(value='assignment')
- AS_EXPRESSION = Name(value='asExpression')
- AWAIT = Name(value='await')
- BINARY = Name(value='binary')
- CALL = Name(value='call')
- CONDITIONAL = Name(value='conditional')
- FUNCTION = Name(value='function')
- IDENTIFIER = Name(value='identifier')
- LITERAL = Name(value='literal')
- MEMBER = Name(value='member')
- NEW = Name(value='new')
- OBJECT = Name(value='object')
- PARENTHESIZED = Name(value='parenthesized')
- SEQUENCE = Name(value='sequence')
- SPREAD = Name(value='spread')
- THIS = Name(value='this')
- TYPE_ = Name(value='hydra.typeScript.syntax.Expression')
- UNARY = Name(value='unary')
- YIELD = Name(value='yield')
- class hydra.type_script.syntax.ExpressionArray(value: T)
Bases:
Node[ArrayExpression]An array expression [a, b, c]
- class hydra.type_script.syntax.ExpressionArrow(value: T)
Bases:
Node[ArrowFunctionExpression]An arrow function expression
- class hydra.type_script.syntax.ExpressionAsExpression(value: T)
Bases:
Node[AsExpression]A TypeScript type assertion <expr> as <type>
- class hydra.type_script.syntax.ExpressionAssignment(value: T)
Bases:
Node[AssignmentExpression]An assignment expression
- class hydra.type_script.syntax.ExpressionAwait(value: T)
Bases:
Node[Expression]An await expression
- class hydra.type_script.syntax.ExpressionBinary(value: T)
Bases:
Node[BinaryExpression]A binary operation expression
- class hydra.type_script.syntax.ExpressionCall(value: T)
Bases:
Node[CallExpression]A function call expression
- class hydra.type_script.syntax.ExpressionConditional(value: T)
Bases:
Node[ConditionalExpression]A conditional (ternary) expression
- class hydra.type_script.syntax.ExpressionFunction(value: T)
Bases:
Node[FunctionExpression]A function expression
- class hydra.type_script.syntax.ExpressionIdentifier(value: T)
Bases:
Node[Identifier]A simple identifier
- class hydra.type_script.syntax.ExpressionMember(value: T)
Bases:
Node[MemberExpression]A member access expression (obj.prop or obj[prop])
- class hydra.type_script.syntax.ExpressionNew(value: T)
Bases:
Node[CallExpression]A ‘new’ expression
- class hydra.type_script.syntax.ExpressionObject(value: T)
Bases:
Node[ObjectExpression]An object expression {a: 1, b: 2}
- class hydra.type_script.syntax.ExpressionParenthesized(value: T)
Bases:
Node[Expression]A parenthesized expression
- class hydra.type_script.syntax.ExpressionSequence(value: T)
Bases:
Node[Sequence[Expression]]A sequence expression (a, b, c)
- class hydra.type_script.syntax.ExpressionSpread(value: T)
Bases:
Node[SpreadElement]A spread expression (…x)
- class hydra.type_script.syntax.ExpressionThis
Bases:
objectThe ‘this’ keyword
- class hydra.type_script.syntax.ExpressionUnary(value: T)
Bases:
Node[UnaryExpression]A unary operation expression
- class hydra.type_script.syntax.ExpressionYield(value: T)
Bases:
Node[Optional[Expression]]A yield expression
- class hydra.type_script.syntax.ForInLeft
Bases:
objectForInLeftVariable | ForInLeftPattern
- PATTERN = Name(value='pattern')
- TYPE_ = Name(value='hydra.typeScript.syntax.ForInLeft')
- VARIABLE = Name(value='variable')
- class hydra.type_script.syntax.ForInLeftVariable(value: T)
Bases:
Node[VariableDeclaration]
- class hydra.type_script.syntax.ForInStatement(left: ForInLeft, right: Expression, body: Statement)
Bases:
objectA for-in statement.
- BODY = Name(value='body')
- class Builder(_left: 'ForInLeft' = None, _right: 'Expression' = None, _body: 'Statement' = None)
Bases:
object- body(body)
- build()
- left(left)
- right(right)
- LEFT = Name(value='left')
- RIGHT = Name(value='right')
- TYPE_ = Name(value='hydra.typeScript.syntax.ForInStatement')
- static builder()
- right: Expression
- with_body(body)
- with_left(left)
- with_right(right)
- class hydra.type_script.syntax.ForInit
Bases:
objectForInitVariable | ForInitExpression
- EXPRESSION = Name(value='expression')
- TYPE_ = Name(value='hydra.typeScript.syntax.ForInit')
- VARIABLE = Name(value='variable')
- class hydra.type_script.syntax.ForInitExpression(value: T)
Bases:
Node[Expression]
- class hydra.type_script.syntax.ForInitVariable(value: T)
Bases:
Node[VariableDeclaration]
- class hydra.type_script.syntax.ForOfStatement(await_: Annotated[bool, 'Whether this is a for-await-of'], left: ForInLeft, right: Expression, body: Statement)
Bases:
objectA for-of statement.
- AWAIT = Name(value='await')
- BODY = Name(value='body')
- class Builder(_await_: 'bool' = None, _left: 'ForInLeft' = None, _right: 'Expression' = None, _body: 'Statement' = None)
Bases:
object- await_(await_)
- body(body)
- build()
- left(left)
- right(right)
- LEFT = Name(value='left')
- RIGHT = Name(value='right')
- TYPE_ = Name(value='hydra.typeScript.syntax.ForOfStatement')
- await_: Annotated[bool, 'Whether this is a for-await-of']
- static builder()
- right: Expression
- with_await_(await_)
- with_body(body)
- with_left(left)
- with_right(right)
- class hydra.type_script.syntax.ForStatement(init: Annotated[object, 'Initialization'], test: Annotated[object, 'Test condition'], update: Annotated[object, 'Update expression'], body: Statement)
Bases:
objectA for statement.
- BODY = Name(value='body')
- class Builder(_init: 'Optional[ForInit]' = None, _test: 'Optional[Expression]' = None, _update: 'Optional[Expression]' = None, _body: 'Statement' = None)
Bases:
object- body(body)
- build()
- init(init)
- test(test)
- update(update)
- INIT = Name(value='init')
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.ForStatement')
- UPDATE = Name(value='update')
- static builder()
- with_body(body)
- with_init(init)
- with_test(test)
- with_update(update)
- class hydra.type_script.syntax.FunctionDeclaration(id: Annotated[Identifier, 'Function name'], params: Annotated[Sequence[Pattern], 'Function parameters'], body: Annotated[Sequence[Statement], 'Function body'], async_: Annotated[bool, 'Whether the function is async'], generator: Annotated[bool, 'Whether the function is a generator'])
Bases:
objectA function declaration.
- ASYNC = Name(value='async')
- BODY = Name(value='body')
- class Builder(_id: 'Identifier' = None, _params: 'Sequence[Pattern]' = None, _body: 'BlockStatement' = None, _async_: 'bool' = None, _generator: 'bool' = None)
Bases:
object- async_(async_)
- body(body)
- build()
- generator(generator)
- id(id)
- params(params)
- GENERATOR = Name(value='generator')
- ID = Name(value='id')
- PARAMS = Name(value='params')
- TYPE_ = Name(value='hydra.typeScript.syntax.FunctionDeclaration')
- async_: Annotated[bool, 'Whether the function is async']
- static builder()
- generator: Annotated[bool, 'Whether the function is a generator']
- id: Annotated[Identifier, 'Function name']
- with_async_(async_)
- with_body(body)
- with_generator(generator)
- with_id(id)
- with_params(params)
- class hydra.type_script.syntax.FunctionDeclarationWithComments(body: Annotated[FunctionDeclaration, 'The function declaration'], comments: Annotated[object, 'Optional JSDoc comment'])
Bases:
objectA function declaration with optional JSDoc.
- BODY = Name(value='body')
- class Builder(_body: 'FunctionDeclaration' = None, _comments: 'Optional[DocumentationComment]' = None)
Bases:
object- body(body)
- build()
- comments(comments)
- COMMENTS = Name(value='comments')
- TYPE_ = Name(value='hydra.typeScript.syntax.FunctionDeclarationWithComments')
- body: Annotated[FunctionDeclaration, 'The function declaration']
- static builder()
- with_body(body)
- with_comments(comments)
- class hydra.type_script.syntax.FunctionExpression(id: Annotated[object, 'Optional function name'], params: Annotated[Sequence[Pattern], 'Function parameters'], body: Annotated[Sequence[Statement], 'Function body'], async_: Annotated[bool, 'Whether the function is async'], generator: Annotated[bool, 'Whether the function is a generator'])
Bases:
objectA function expression.
- ASYNC = Name(value='async')
- BODY = Name(value='body')
- class Builder(_id: 'Optional[Identifier]' = None, _params: 'Sequence[Pattern]' = None, _body: 'BlockStatement' = None, _async_: 'bool' = None, _generator: 'bool' = None)
Bases:
object- async_(async_)
- body(body)
- build()
- generator(generator)
- id(id)
- params(params)
- GENERATOR = Name(value='generator')
- ID = Name(value='id')
- PARAMS = Name(value='params')
- TYPE_ = Name(value='hydra.typeScript.syntax.FunctionExpression')
- async_: Annotated[bool, 'Whether the function is async']
- static builder()
- generator: Annotated[bool, 'Whether the function is a generator']
- with_async_(async_)
- with_body(body)
- with_generator(generator)
- with_id(id)
- with_params(params)
- class hydra.type_script.syntax.FunctionTypeExpression(type_parameters: Annotated[Sequence[TypeParameter], 'Type parameters (generics)'], parameters: Annotated[Sequence[TypeExpression], 'Parameter types'], return_type: Annotated[TypeExpression, 'Return type'])
Bases:
objectA function type expression.
- class Builder(_type_parameters: 'Sequence[TypeParameter]' = None, _parameters: 'Sequence[TypeExpression]' = None, _return_type: 'TypeExpression' = None)
Bases:
object- build()
- parameters(parameters)
- return_type(return_type)
- type_parameters(type_parameters)
- PARAMETERS = Name(value='parameters')
- RETURN_TYPE = Name(value='returnType')
- TYPE_ = Name(value='hydra.typeScript.syntax.FunctionTypeExpression')
- TYPE_PARAMETERS = Name(value='typeParameters')
- static builder()
- parameters: Annotated[Sequence[TypeExpression], 'Parameter types']
- return_type: Annotated[TypeExpression, 'Return type']
- type_parameters: Annotated[Sequence[TypeParameter], 'Type parameters (generics)']
- with_parameters(parameters)
- with_return_type(return_type)
- with_type_parameters(type_parameters)
- class hydra.type_script.syntax.Identifier(value: T)
Bases:
Node[str]A TypeScript identifier (variable, function, class name, etc.).
- TYPE_ = Name(value='hydra.typeScript.syntax.Identifier')
- class hydra.type_script.syntax.IfStatement(test: Expression, consequent: Statement, alternate: object)
Bases:
objectAn if statement.
- ALTERNATE = Name(value='alternate')
- class Builder(_test: 'Expression' = None, _consequent: 'Statement' = None, _alternate: 'Optional[Statement]' = None)
Bases:
object- alternate(alternate)
- build()
- consequent(consequent)
- test(test)
- CONSEQUENT = Name(value='consequent')
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.IfStatement')
- static builder()
- test: Expression
- with_alternate(alternate)
- with_consequent(consequent)
- with_test(test)
- class hydra.type_script.syntax.ImportClause
Bases:
objectImportClauseNamed | ImportClauseDefault | ImportClauseNamespace
- DEFAULT = Name(value='default')
- NAMED = Name(value='named')
- NAMESPACE = Name(value='namespace')
- TYPE_ = Name(value='hydra.typeScript.syntax.ImportClause')
- class hydra.type_script.syntax.ImportClauseDefault(value: T)
Bases:
Node[ImportDefaultSpecifier]
- class hydra.type_script.syntax.ImportClauseNamed(value: T)
Bases:
Node[ImportSpecifier]
- class hydra.type_script.syntax.ImportClauseNamespace(value: T)
Bases:
Node[ImportNamespaceSpecifier]
- class hydra.type_script.syntax.ImportDeclaration(specifiers: Annotated[Sequence[ImportClause], 'What to import'], source: Annotated[StringLiteral, 'The module to import from'])
Bases:
objectAn import declaration.
- class Builder(_specifiers: 'Sequence[ImportClause]' = None, _source: 'StringLiteral' = None)
Bases:
object- build()
- source(source)
- specifiers(specifiers)
- SOURCE = Name(value='source')
- SPECIFIERS = Name(value='specifiers')
- TYPE_ = Name(value='hydra.typeScript.syntax.ImportDeclaration')
- static builder()
- source: Annotated[StringLiteral, 'The module to import from']
- specifiers: Annotated[Sequence[ImportClause], 'What to import']
- with_source(source)
- with_specifiers(specifiers)
- class hydra.type_script.syntax.ImportDefaultSpecifier(value: T)
Bases:
Node[Identifier]A default import specifier (import x from …).
- TYPE_ = Name(value='hydra.typeScript.syntax.ImportDefaultSpecifier')
- class hydra.type_script.syntax.ImportNamespaceSpecifier(value: T)
Bases:
Node[Identifier]A namespace import specifier (import * as x from …).
- TYPE_ = Name(value='hydra.typeScript.syntax.ImportNamespaceSpecifier')
- class hydra.type_script.syntax.ImportSpecifier(imported: Identifier, local: Identifier)
Bases:
objectA named import specifier (import {x as y} from …).
- class Builder(_imported: 'Identifier' = None, _local: 'Identifier' = None)
Bases:
object- build()
- imported(imported)
- local(local)
- IMPORTED = Name(value='imported')
- LOCAL = Name(value='local')
- TYPE_ = Name(value='hydra.typeScript.syntax.ImportSpecifier')
- static builder()
- imported: Identifier
- local: Identifier
- with_imported(imported)
- with_local(local)
- class hydra.type_script.syntax.InterfaceDeclaration(name: Annotated[Identifier, 'Interface name'], type_parameters: Annotated[Sequence[TypeParameter], 'Generic parameters'], extends: Annotated[Sequence[TypeExpression], 'Interfaces this one extends'], members: Annotated[Sequence[PropertySignature], 'Property signatures (the interface body)'])
Bases:
objectA TypeScript interface declaration (interface Foo<T> extends Bar { … }).
- class Builder(_name: 'Identifier' = None, _type_parameters: 'Sequence[TypeParameter]' = None, _extends: 'Sequence[TypeExpression]' = None, _members: 'Sequence[PropertySignature]' = None)
Bases:
object- build()
- extends(extends)
- members(members)
- name(name)
- type_parameters(type_parameters)
- EXTENDS = Name(value='extends')
- MEMBERS = Name(value='members')
- NAME = Name(value='name')
- TYPE_ = Name(value='hydra.typeScript.syntax.InterfaceDeclaration')
- TYPE_PARAMETERS = Name(value='typeParameters')
- static builder()
- extends: Annotated[Sequence[TypeExpression], 'Interfaces this one extends']
- members: Annotated[Sequence[PropertySignature], 'Property signatures (the interface body)']
- name: Annotated[Identifier, 'Interface name']
- type_parameters: Annotated[Sequence[TypeParameter], 'Generic parameters']
- with_extends(extends)
- with_members(members)
- with_name(name)
- with_type_parameters(type_parameters)
- class hydra.type_script.syntax.LabeledStatement(label: Identifier, body: Statement)
Bases:
objectA labeled statement.
- BODY = Name(value='body')
- class Builder(_label: 'Identifier' = None, _body: 'Statement' = None)
Bases:
object- body(body)
- build()
- label(label)
- LABEL = Name(value='label')
- TYPE_ = Name(value='hydra.typeScript.syntax.LabeledStatement')
- static builder()
- label: Identifier
- with_body(body)
- with_label(label)
- class hydra.type_script.syntax.Literal
Bases:
objectLiteralString | LiteralNumber | LiteralBoolean | LiteralNull | LiteralUndefined | LiteralBigInt | LiteralTemplate
- BIG_INT = Name(value='bigInt')
- BOOLEAN = Name(value='boolean')
- NULL = Name(value='null')
- NUMBER = Name(value='number')
- STRING = Name(value='string')
- TEMPLATE = Name(value='template')
- TYPE_ = Name(value='hydra.typeScript.syntax.Literal')
- UNDEFINED = Name(value='undefined')
- class hydra.type_script.syntax.LiteralBigInt(value: T)
Bases:
Node[int]A BigInt literal (e.g., 123n)
- class hydra.type_script.syntax.LiteralBoolean(value: T)
Bases:
Node[bool]A boolean literal (true or false)
- class hydra.type_script.syntax.LiteralNull
Bases:
objectThe null literal
- class hydra.type_script.syntax.LiteralNumber(value: T)
Bases:
Node[NumericLiteral]A numeric literal
- class hydra.type_script.syntax.LiteralString(value: T)
Bases:
Node[StringLiteral]A string literal
- class hydra.type_script.syntax.LiteralTemplate(value: T)
Bases:
Node[TemplateLiteral]A template literal
- class hydra.type_script.syntax.LiteralUndefined
Bases:
objectThe undefined literal
- class hydra.type_script.syntax.MemberExpression(object: Annotated[Expression, 'The object'], property: Annotated[Expression, 'The property'], computed: Annotated[bool, 'Whether using bracket notation (obj[prop])'], optional: Annotated[bool, 'Whether using optional chaining (?.)'])
Bases:
objectA member access expression.
- class Builder(_object: 'Expression' = None, _property: 'Expression' = None, _computed: 'bool' = None, _optional: 'bool' = None)
Bases:
object- build()
- computed(computed)
- object(object)
- optional(optional)
- property(property)
- COMPUTED = Name(value='computed')
- OBJECT = Name(value='object')
- OPTIONAL = Name(value='optional')
- PROPERTY = Name(value='property')
- TYPE_ = Name(value='hydra.typeScript.syntax.MemberExpression')
- static builder()
- computed: Annotated[bool, 'Whether using bracket notation (obj[prop])']
- object: Annotated[Expression, 'The object']
- optional: Annotated[bool, 'Whether using optional chaining (?.)']
- property: Annotated[Expression, 'The property']
- with_computed(computed)
- with_object(object)
- with_optional(optional)
- with_property(property)
- class hydra.type_script.syntax.MethodDefinition(key: Annotated[Expression, 'Method name'], value: Annotated[FunctionExpression, 'Method function'], kind: Annotated[MethodKind, 'Method kind'], computed: Annotated[bool, 'Whether the key is computed'], static: Annotated[bool, 'Whether the method is static'])
Bases:
objectA method definition in a class.
- class Builder(_key: 'Expression' = None, _value: 'FunctionExpression' = None, _kind: 'MethodKind' = None, _computed: 'bool' = None, _static: 'bool' = None)
Bases:
object- build()
- computed(computed)
- key(key)
- kind(kind)
- static(static)
- value(value)
- COMPUTED = Name(value='computed')
- KEY = Name(value='key')
- KIND = Name(value='kind')
- STATIC = Name(value='static')
- TYPE_ = Name(value='hydra.typeScript.syntax.MethodDefinition')
- VALUE = Name(value='value')
- static builder()
- computed: Annotated[bool, 'Whether the key is computed']
- key: Annotated[Expression, 'Method name']
- kind: Annotated[MethodKind, 'Method kind']
- static: Annotated[bool, 'Whether the method is static']
- value: Annotated[FunctionExpression, 'Method function']
- with_computed(computed)
- with_key(key)
- with_kind(kind)
- with_static(static)
- with_value(value)
- class hydra.type_script.syntax.MethodKind(*values)
Bases:
EnumThe kind of a class method.
- CONSTRUCTOR = Name(value='constructor')
- GET = Name(value='get')
- METHOD = Name(value='method')
- SET = Name(value='set')
- TYPE_ = Name(value='hydra.typeScript.syntax.MethodKind')
- class hydra.type_script.syntax.ModuleItem
Bases:
objectModuleItemStatement | ModuleItemImport | ModuleItemExport | ModuleItemInterface | ModuleItemTypeAlias
- EXPORT = Name(value='export')
- IMPORT = Name(value='import')
- INTERFACE = Name(value='interface')
- STATEMENT = Name(value='statement')
- TYPE_ = Name(value='hydra.typeScript.syntax.ModuleItem')
- TYPE_ALIAS = Name(value='typeAlias')
- class hydra.type_script.syntax.ModuleItemExport(value: T)
Bases:
Node[ExportDeclaration]
- class hydra.type_script.syntax.ModuleItemImport(value: T)
Bases:
Node[ImportDeclaration]
- class hydra.type_script.syntax.ModuleItemInterface(value: T)
Bases:
Node[InterfaceDeclaration]A top-level interface declaration
- class hydra.type_script.syntax.ModuleItemTypeAlias(value: T)
Bases:
Node[TypeAliasDeclaration]A top-level type alias declaration
- class hydra.type_script.syntax.ModuleItemWithComments(body: Annotated[ModuleItem, 'The module item'], comments: Annotated[object, 'Optional documentation comment'])
Bases:
objectA module item with optional documentation.
- BODY = Name(value='body')
- class Builder(_body: 'ModuleItem' = None, _comments: 'Optional[DocumentationComment]' = None)
Bases:
object- body(body)
- build()
- comments(comments)
- COMMENTS = Name(value='comments')
- TYPE_ = Name(value='hydra.typeScript.syntax.ModuleItemWithComments')
- body: Annotated[ModuleItem, 'The module item']
- static builder()
- with_body(body)
- with_comments(comments)
- class hydra.type_script.syntax.NamedExport(specifiers: Sequence[ExportSpecifier], source: object)
Bases:
objectNamed exports (export {x, y as z}).
- class Builder(_specifiers: 'Sequence[ExportSpecifier]' = None, _source: 'Optional[StringLiteral]' = None)
Bases:
object- build()
- source(source)
- specifiers(specifiers)
- SOURCE = Name(value='source')
- SPECIFIERS = Name(value='specifiers')
- TYPE_ = Name(value='hydra.typeScript.syntax.NamedExport')
- static builder()
- specifiers: Sequence[ExportSpecifier]
- with_source(source)
- with_specifiers(specifiers)
- class hydra.type_script.syntax.NumericLiteral
Bases:
objectNumericLiteralInteger | NumericLiteralFloat
- FLOAT = Name(value='float')
- INTEGER = Name(value='integer')
- TYPE_ = Name(value='hydra.typeScript.syntax.NumericLiteral')
- class hydra.type_script.syntax.NumericLiteralFloat(value: T)
Bases:
Node[float]A floating-point literal
- class hydra.type_script.syntax.ObjectPattern(properties: Annotated[Sequence[ObjectPatternProperty], 'The property patterns'])
Bases:
objectAn object destructuring pattern {a, b: c}.
- class Builder(_properties: 'Sequence[ObjectPatternProperty]' = None)
Bases:
object- build()
- properties(properties)
- PROPERTIES = Name(value='properties')
- TYPE_ = Name(value='hydra.typeScript.syntax.ObjectPattern')
- static builder()
- properties: Annotated[Sequence[ObjectPatternProperty], 'The property patterns']
- with_properties(properties)
- class hydra.type_script.syntax.ObjectPatternProperty
Bases:
objectObjectPatternPropertyProperty | ObjectPatternPropertyRest
- PROPERTY = Name(value='property')
- REST = Name(value='rest')
- TYPE_ = Name(value='hydra.typeScript.syntax.ObjectPatternProperty')
- class hydra.type_script.syntax.ObjectPatternPropertyRest(value: T)
Bases:
Node[RestElement]
- class hydra.type_script.syntax.ParameterizedTypeExpression(base: TypeExpression, arguments: Sequence[TypeExpression])
Bases:
objectA parameterized type (e.g., Array<T>, Map<K, V>).
- ARGUMENTS = Name(value='arguments')
- BASE = Name(value='base')
- class Builder(_base: 'TypeExpression' = None, _arguments: 'Sequence[TypeExpression]' = None)
Bases:
object- arguments(arguments)
- base(base)
- build()
- TYPE_ = Name(value='hydra.typeScript.syntax.ParameterizedTypeExpression')
- arguments: Sequence[TypeExpression]
- base: TypeExpression
- static builder()
- with_arguments(arguments)
- with_base(base)
- class hydra.type_script.syntax.Pattern
Bases:
objectPatternIdentifier | PatternObject | PatternArray | PatternAssignment | PatternRest | PatternTyped
- ARRAY = Name(value='array')
- ASSIGNMENT = Name(value='assignment')
- IDENTIFIER = Name(value='identifier')
- OBJECT = Name(value='object')
- REST = Name(value='rest')
- TYPED = Name(value='typed')
- TYPE_ = Name(value='hydra.typeScript.syntax.Pattern')
- class hydra.type_script.syntax.PatternArray(value: T)
Bases:
Node[ArrayPattern]An array destructuring pattern
- class hydra.type_script.syntax.PatternAssignment(value: T)
Bases:
Node[AssignmentPattern]A pattern with default value
- class hydra.type_script.syntax.PatternIdentifier(value: T)
Bases:
Node[Identifier]A simple identifier binding
- class hydra.type_script.syntax.PatternObject(value: T)
Bases:
Node[ObjectPattern]An object destructuring pattern
- class hydra.type_script.syntax.PatternRest(value: T)
Bases:
Node[RestElement]A rest element (…x)
- class hydra.type_script.syntax.PatternTyped(value: T)
Bases:
Node[TypedPattern]A pattern with a TypeScript type annotation (x: T)
- class hydra.type_script.syntax.Program(body: Annotated[Sequence[ModuleItem], 'The module items'], source_type: Annotated[SourceType, 'Whether this is a module or script'])
Bases:
objectA TypeScript program (module).
- BODY = Name(value='body')
- class Builder(_body: 'Sequence[ModuleItem]' = None, _source_type: 'SourceType' = None)
Bases:
object- body(body)
- build()
- source_type(source_type)
- SOURCE_TYPE = Name(value='sourceType')
- TYPE_ = Name(value='hydra.typeScript.syntax.Program')
- body: Annotated[Sequence[ModuleItem], 'The module items']
- static builder()
- source_type: Annotated[SourceType, 'Whether this is a module or script']
- with_body(body)
- with_source_type(source_type)
- class hydra.type_script.syntax.Property(key: Annotated[Expression, 'Property key (identifier, literal, or computed)'], value: Annotated[Expression, 'Property value'], kind: Annotated[PropertyKind, 'Property kind (init, get, set)'], computed: Annotated[bool, 'Whether the key is computed [expr]'], shorthand: Annotated[bool, 'Whether using shorthand syntax {x} for {x: x}'])
Bases:
objectA property in an object expression.
- class Builder(_key: 'Expression' = None, _value: 'Expression' = None, _kind: 'PropertyKind' = None, _computed: 'bool' = None, _shorthand: 'bool' = None)
Bases:
object- build()
- computed(computed)
- key(key)
- kind(kind)
- shorthand(shorthand)
- value(value)
- COMPUTED = Name(value='computed')
- KEY = Name(value='key')
- KIND = Name(value='kind')
- SHORTHAND = Name(value='shorthand')
- TYPE_ = Name(value='hydra.typeScript.syntax.Property')
- VALUE = Name(value='value')
- static builder()
- computed: Annotated[bool, 'Whether the key is computed [expr]']
- key: Annotated[Expression, 'Property key (identifier, literal, or computed)']
- kind: Annotated[PropertyKind, 'Property kind (init, get, set)']
- shorthand: Annotated[bool, 'Whether using shorthand syntax {x} for {x: x}']
- value: Annotated[Expression, 'Property value']
- with_computed(computed)
- with_key(key)
- with_kind(kind)
- with_shorthand(shorthand)
- with_value(value)
- class hydra.type_script.syntax.PropertyKind(*values)
Bases:
EnumThe kind of an object property.
- GET = Name(value='get')
A getter
- INIT = Name(value='init')
A normal property initialization
- SET = Name(value='set')
A setter
- TYPE_ = Name(value='hydra.typeScript.syntax.PropertyKind')
- class hydra.type_script.syntax.PropertySignature(name: Annotated[Identifier, 'Property name'], type: Annotated[TypeExpression, 'Property type'], optional: Annotated[bool, 'Whether the property is optional'], readonly: Annotated[bool, 'Whether the property is readonly'], comments: Annotated[object, 'Optional JSDoc documentation comment to emit above this property'])
Bases:
objectA property signature in an object type.
- class Builder(_name: 'Identifier' = None, _type: 'TypeExpression' = None, _optional: 'bool' = None, _readonly: 'bool' = None, _comments: 'Optional[DocumentationComment]' = None)
Bases:
object- build()
- comments(comments)
- name(name)
- optional(optional)
- readonly(readonly)
- type(type)
- COMMENTS = Name(value='comments')
- NAME = Name(value='name')
- OPTIONAL = Name(value='optional')
- READONLY = Name(value='readonly')
- TYPE = Name(value='type')
- TYPE_ = Name(value='hydra.typeScript.syntax.PropertySignature')
- static builder()
- name: Annotated[Identifier, 'Property name']
- optional: Annotated[bool, 'Whether the property is optional']
- readonly: Annotated[bool, 'Whether the property is readonly']
- type: Annotated[TypeExpression, 'Property type']
- with_comments(comments)
- with_name(name)
- with_optional(optional)
- with_readonly(readonly)
- with_type(type)
- class hydra.type_script.syntax.RestElement(value: T)
-
A rest element pattern (…x).
- TYPE_ = Name(value='hydra.typeScript.syntax.RestElement')
- class hydra.type_script.syntax.SourceType(*values)
Bases:
EnumWhether the program is a module or script.
- MODULE = Name(value='module')
- SCRIPT = Name(value='script')
- TYPE_ = Name(value='hydra.typeScript.syntax.SourceType')
- class hydra.type_script.syntax.SpreadElement(value: T)
Bases:
Node[Expression]A spread element (…x).
- TYPE_ = Name(value='hydra.typeScript.syntax.SpreadElement')
- class hydra.type_script.syntax.Statement
Bases:
objectStatementExpression | StatementBlock | StatementEmpty | StatementDebugger | StatementReturn | StatementBreak | StatementContinue | StatementIf | StatementSwitch | StatementThrow | StatementTry | StatementWhile | StatementDoWhile | StatementFor | StatementForIn | StatementForOf | StatementVariableDeclaration | StatementFunctionDeclaration | StatementClassDeclaration | StatementLabeled
- BLOCK = Name(value='block')
- BREAK = Name(value='break')
- CLASS_DECLARATION = Name(value='classDeclaration')
- CONTINUE = Name(value='continue')
- DEBUGGER = Name(value='debugger')
- DO_WHILE = Name(value='doWhile')
- EMPTY = Name(value='empty')
- EXPRESSION = Name(value='expression')
- FOR = Name(value='for')
- FOR_IN = Name(value='forIn')
- FOR_OF = Name(value='forOf')
- FUNCTION_DECLARATION = Name(value='functionDeclaration')
- IF = Name(value='if')
- LABELED = Name(value='labeled')
- RETURN = Name(value='return')
- SWITCH = Name(value='switch')
- THROW = Name(value='throw')
- TRY = Name(value='try')
- TYPE_ = Name(value='hydra.typeScript.syntax.Statement')
- VARIABLE_DECLARATION = Name(value='variableDeclaration')
- WHILE = Name(value='while')
- class hydra.type_script.syntax.StatementBlock(value: T)
Bases:
Node[BlockStatement]A block statement
- class hydra.type_script.syntax.StatementBreak(value: T)
Bases:
Node[BreakStatement]A break statement
- class hydra.type_script.syntax.StatementClassDeclaration(value: T)
Bases:
Node[ClassDeclaration]A class declaration
- class hydra.type_script.syntax.StatementContinue(value: T)
Bases:
Node[ContinueStatement]A continue statement
- class hydra.type_script.syntax.StatementDebugger
Bases:
objectA debugger statement
- class hydra.type_script.syntax.StatementDoWhile(value: T)
Bases:
Node[DoWhileStatement]A do-while statement
- class hydra.type_script.syntax.StatementEmpty
Bases:
objectAn empty statement (;)
- class hydra.type_script.syntax.StatementExpression(value: T)
Bases:
Node[Expression]An expression statement
- class hydra.type_script.syntax.StatementFor(value: T)
Bases:
Node[ForStatement]A for statement
- class hydra.type_script.syntax.StatementForIn(value: T)
Bases:
Node[ForInStatement]A for-in statement
- class hydra.type_script.syntax.StatementForOf(value: T)
Bases:
Node[ForOfStatement]A for-of statement
- class hydra.type_script.syntax.StatementFunctionDeclaration(value: T)
Bases:
Node[FunctionDeclaration]A function declaration
- class hydra.type_script.syntax.StatementIf(value: T)
Bases:
Node[IfStatement]An if statement
- class hydra.type_script.syntax.StatementLabeled(value: T)
Bases:
Node[LabeledStatement]A labeled statement
- class hydra.type_script.syntax.StatementReturn(value: T)
Bases:
Node[ReturnStatement]A return statement
- class hydra.type_script.syntax.StatementSwitch(value: T)
Bases:
Node[SwitchStatement]A switch statement
- class hydra.type_script.syntax.StatementThrow(value: T)
Bases:
Node[ThrowStatement]A throw statement
- class hydra.type_script.syntax.StatementTry(value: T)
Bases:
Node[TryStatement]A try statement
- class hydra.type_script.syntax.StatementVariableDeclaration(value: T)
Bases:
Node[VariableDeclaration]A variable declaration
- class hydra.type_script.syntax.StatementWhile(value: T)
Bases:
Node[WhileStatement]A while statement
- class hydra.type_script.syntax.StatementWithComments(body: Annotated[Statement, 'The statement'], comments: Annotated[object, 'Optional documentation comment'])
Bases:
objectA statement with optional documentation.
- BODY = Name(value='body')
- class Builder(_body: 'Statement' = None, _comments: 'Optional[DocumentationComment]' = None)
Bases:
object- body(body)
- build()
- comments(comments)
- COMMENTS = Name(value='comments')
- TYPE_ = Name(value='hydra.typeScript.syntax.StatementWithComments')
- static builder()
- with_body(body)
- with_comments(comments)
- class hydra.type_script.syntax.StringLiteral(value: Annotated[str, 'The string value'], single_quote: Annotated[bool, 'Whether to use single quotes (true) or double quotes (false)'])
Bases:
objectA string literal with quote style.
- class Builder(_value: 'str' = None, _single_quote: 'bool' = None)
Bases:
object- build()
- single_quote(single_quote)
- value(value)
- SINGLE_QUOTE = Name(value='singleQuote')
- TYPE_ = Name(value='hydra.typeScript.syntax.StringLiteral')
- VALUE = Name(value='value')
- static builder()
- single_quote: Annotated[bool, 'Whether to use single quotes (true) or double quotes (false)']
- value: Annotated[str, 'The string value']
- with_single_quote(single_quote)
- with_value(value)
- class hydra.type_script.syntax.SwitchCase(test: Annotated[object, 'The test expression (Nothing for default)'], consequent: Annotated[Sequence[Statement], 'The statements to execute'])
Bases:
objectA case clause in a switch statement.
- class Builder(_test: 'Optional[Expression]' = None, _consequent: 'Sequence[Statement]' = None)
Bases:
object- build()
- consequent(consequent)
- test(test)
- CONSEQUENT = Name(value='consequent')
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.SwitchCase')
- static builder()
- with_consequent(consequent)
- with_test(test)
- class hydra.type_script.syntax.SwitchStatement(discriminant: Expression, cases: Sequence[SwitchCase])
Bases:
objectA switch statement.
- class Builder(_discriminant: 'Expression' = None, _cases: 'Sequence[SwitchCase]' = None)
Bases:
object- build()
- cases(cases)
- discriminant(discriminant)
- CASES = Name(value='cases')
- DISCRIMINANT = Name(value='discriminant')
- TYPE_ = Name(value='hydra.typeScript.syntax.SwitchStatement')
- static builder()
- cases: Sequence[SwitchCase]
- discriminant: Expression
- with_cases(cases)
- with_discriminant(discriminant)
- class hydra.type_script.syntax.TemplateElement(value: Annotated[str, 'The raw string value'], tail: Annotated[bool, 'Whether this is the last element'])
Bases:
objectA static part of a template literal.
- class Builder(_value: 'str' = None, _tail: 'bool' = None)
Bases:
object- build()
- tail(tail)
- value(value)
- TAIL = Name(value='tail')
- TYPE_ = Name(value='hydra.typeScript.syntax.TemplateElement')
- VALUE = Name(value='value')
- static builder()
- tail: Annotated[bool, 'Whether this is the last element']
- value: Annotated[str, 'The raw string value']
- with_tail(tail)
- with_value(value)
- class hydra.type_script.syntax.TemplateLiteral(quasis: Annotated[Sequence[TemplateElement], 'The static string parts'], expressions: Annotated[Sequence[Expression], 'The interpolated expressions'])
Bases:
objectA template literal (backtick string with interpolations).
- class Builder(_quasis: 'Sequence[TemplateElement]' = None, _expressions: 'Sequence[Expression]' = None)
Bases:
object- build()
- expressions(expressions)
- quasis(quasis)
- EXPRESSIONS = Name(value='expressions')
- QUASIS = Name(value='quasis')
- TYPE_ = Name(value='hydra.typeScript.syntax.TemplateLiteral')
- static builder()
- expressions: Annotated[Sequence[Expression], 'The interpolated expressions']
- quasis: Annotated[Sequence[TemplateElement], 'The static string parts']
- with_expressions(expressions)
- with_quasis(quasis)
- class hydra.type_script.syntax.ThrowStatement(value: T)
Bases:
Node[Expression]A throw statement.
- TYPE_ = Name(value='hydra.typeScript.syntax.ThrowStatement')
- class hydra.type_script.syntax.TryStatement(block: Sequence[Statement], handler: object, finalizer: object)
Bases:
objectA try statement.
- BLOCK = Name(value='block')
- class Builder(_block: 'BlockStatement' = None, _handler: 'Optional[CatchClause]' = None, _finalizer: 'Optional[BlockStatement]' = None)
Bases:
object- block(block)
- build()
- finalizer(finalizer)
- handler(handler)
- FINALIZER = Name(value='finalizer')
- HANDLER = Name(value='handler')
- TYPE_ = Name(value='hydra.typeScript.syntax.TryStatement')
- static builder()
- with_block(block)
- with_finalizer(finalizer)
- with_handler(handler)
- class hydra.type_script.syntax.TypeAliasDeclaration(name: Annotated[Identifier, 'Alias name'], type_parameters: Annotated[Sequence[TypeParameter], 'Generic parameters'], type: Annotated[TypeExpression, 'The right-hand-side type'])
Bases:
objectA TypeScript type alias declaration (type Foo<T> = …).
- class Builder(_name: 'Identifier' = None, _type_parameters: 'Sequence[TypeParameter]' = None, _type: 'TypeExpression' = None)
Bases:
object- build()
- name(name)
- type(type)
- type_parameters(type_parameters)
- NAME = Name(value='name')
- TYPE = Name(value='type')
- TYPE_ = Name(value='hydra.typeScript.syntax.TypeAliasDeclaration')
- TYPE_PARAMETERS = Name(value='typeParameters')
- static builder()
- name: Annotated[Identifier, 'Alias name']
- type: Annotated[TypeExpression, 'The right-hand-side type']
- type_parameters: Annotated[Sequence[TypeParameter], 'Generic parameters']
- with_name(name)
- with_type(type)
- with_type_parameters(type_parameters)
- class hydra.type_script.syntax.TypeAnnotation(value: T)
Bases:
Node[TypeExpression]A type annotation (for JSDoc comments or TypeScript).
- TYPE_ = Name(value='hydra.typeScript.syntax.TypeAnnotation')
- class hydra.type_script.syntax.TypeExpression
Bases:
objectTypeExpressionIdentifier | TypeExpressionLiteral | TypeExpressionArray | TypeExpressionFunction | TypeExpressionObject | TypeExpressionTuple | TypeExpressionUnion | TypeExpressionIntersection | TypeExpressionParameterized | TypeExpressionOptional | TypeExpressionReadonly | TypeExpressionAny | TypeExpressionUnknown | TypeExpressionVoid | TypeExpressionNever
- ANY = Name(value='any')
- ARRAY = Name(value='array')
- FUNCTION = Name(value='function')
- IDENTIFIER = Name(value='identifier')
- INTERSECTION = Name(value='intersection')
- LITERAL = Name(value='literal')
- NEVER = Name(value='never')
- OBJECT = Name(value='object')
- OPTIONAL = Name(value='optional')
- PARAMETERIZED = Name(value='parameterized')
- READONLY = Name(value='readonly')
- TUPLE = Name(value='tuple')
- TYPE_ = Name(value='hydra.typeScript.syntax.TypeExpression')
- UNION = Name(value='union')
- UNKNOWN = Name(value='unknown')
- VOID = Name(value='void')
- class hydra.type_script.syntax.TypeExpressionAny
Bases:
objectThe ‘any’ type
- class hydra.type_script.syntax.TypeExpressionArray(value: T)
Bases:
Node[ArrayTypeExpression]An array type
- class hydra.type_script.syntax.TypeExpressionFunction(value: T)
Bases:
Node[FunctionTypeExpression]A function type
- class hydra.type_script.syntax.TypeExpressionIdentifier(value: T)
Bases:
Node[Identifier]A named type (e.g., ‘string’, ‘number’, ‘MyClass’)
- class hydra.type_script.syntax.TypeExpressionIntersection(value: T)
Bases:
Node[IntersectionTypeExpression]An intersection type (A & B)
- class hydra.type_script.syntax.TypeExpressionLiteral(value: T)
-
A literal type (e.g., ‘hello’, 42)
- class hydra.type_script.syntax.TypeExpressionNever
Bases:
objectThe ‘never’ type
- class hydra.type_script.syntax.TypeExpressionObject(value: T)
Bases:
Node[ObjectTypeExpression]An object type
- class hydra.type_script.syntax.TypeExpressionOptional(value: T)
Bases:
Node[TypeExpression]An optional type (T | undefined or T?)
- class hydra.type_script.syntax.TypeExpressionParameterized(value: T)
Bases:
Node[ParameterizedTypeExpression]A parameterized type (e.g., Array<T>, Map<K, V>)
- class hydra.type_script.syntax.TypeExpressionReadonly(value: T)
Bases:
Node[TypeExpression]A readonly modifier (readonly T[], readonly [A, B])
- class hydra.type_script.syntax.TypeExpressionTuple(value: T)
Bases:
Node[TupleTypeExpression]A tuple type (readonly [A, B, C])
- class hydra.type_script.syntax.TypeExpressionUnion(value: T)
Bases:
Node[UnionTypeExpression]A union type (A | B)
- class hydra.type_script.syntax.TypeExpressionUnknown
Bases:
objectThe ‘unknown’ type
- class hydra.type_script.syntax.TypeExpressionVoid
Bases:
objectThe ‘void’ type
- class hydra.type_script.syntax.TypeParameter(name: Annotated[Identifier, 'Parameter name'], constraint: Annotated[object, 'Optional constraint (extends clause)'], default: Annotated[object, 'Optional default type'])
Bases:
objectA type parameter (generic).
- class Builder(_name: 'Identifier' = None, _constraint: 'Optional[TypeExpression]' = None, _default: 'Optional[TypeExpression]' = None)
Bases:
object- build()
- constraint(constraint)
- default(default)
- name(name)
- CONSTRAINT = Name(value='constraint')
- DEFAULT = Name(value='default')
- NAME = Name(value='name')
- TYPE_ = Name(value='hydra.typeScript.syntax.TypeParameter')
- static builder()
- name: Annotated[Identifier, 'Parameter name']
- with_constraint(constraint)
- with_default(default)
- with_name(name)
- class hydra.type_script.syntax.TypedPattern(pattern: Annotated[Pattern, 'The underlying binding pattern'], type: Annotated[TypeExpression, 'The TypeScript type annotation'])
Bases:
objectA pattern with a TypeScript type annotation (x: T).
- class Builder(_pattern: 'Pattern' = None, _type: 'TypeExpression' = None)
Bases:
object- build()
- pattern(pattern)
- type(type)
- PATTERN = Name(value='pattern')
- TYPE = Name(value='type')
- TYPE_ = Name(value='hydra.typeScript.syntax.TypedPattern')
- static builder()
- type: Annotated[TypeExpression, 'The TypeScript type annotation']
- with_pattern(pattern)
- with_type(type)
- class hydra.type_script.syntax.UnaryExpression(operator: UnaryOperator, argument: Expression, prefix: Annotated[bool, 'Whether the operator is prefix (true) or postfix (false)'])
Bases:
objectA unary operation expression.
- ARGUMENT = Name(value='argument')
- class Builder(_operator: 'UnaryOperator' = None, _argument: 'Expression' = None, _prefix: 'bool' = None)
Bases:
object- argument(argument)
- build()
- operator(operator)
- prefix(prefix)
- OPERATOR = Name(value='operator')
- PREFIX = Name(value='prefix')
- TYPE_ = Name(value='hydra.typeScript.syntax.UnaryExpression')
- argument: Expression
- static builder()
- operator: UnaryOperator
- prefix: Annotated[bool, 'Whether the operator is prefix (true) or postfix (false)']
- with_argument(argument)
- with_operator(operator)
- with_prefix(prefix)
- class hydra.type_script.syntax.UnaryOperator(*values)
Bases:
EnumA unary operator.
- BITWISE_NOT = Name(value='bitwiseNot')
~
- DECREMENT = Name(value='decrement')
–
- DELETE = Name(value='delete')
delete
- INCREMENT = Name(value='increment')
++
- NEGATE = Name(value='negate')
- NOT = Name(value='not')
!
- PLUS = Name(value='plus')
- TYPEOF = Name(value='typeof')
typeof
- TYPE_ = Name(value='hydra.typeScript.syntax.UnaryOperator')
- VOID = Name(value='void')
void
- class hydra.type_script.syntax.VariableDeclaration(kind: VariableKind, declarations: Sequence[VariableDeclarator])
Bases:
objectA variable declaration (var, let, const).
- class Builder(_kind: 'VariableKind' = None, _declarations: 'Sequence[VariableDeclarator]' = None)
Bases:
object- build()
- declarations(declarations)
- kind(kind)
- DECLARATIONS = Name(value='declarations')
- KIND = Name(value='kind')
- TYPE_ = Name(value='hydra.typeScript.syntax.VariableDeclaration')
- static builder()
- declarations: Sequence[VariableDeclarator]
- kind: VariableKind
- with_declarations(declarations)
- with_kind(kind)
- class hydra.type_script.syntax.VariableDeclarator(id: Pattern, init: object)
Bases:
objectA variable declarator (id = init).
- class Builder(_id: 'Pattern' = None, _init: 'Optional[Expression]' = None)
Bases:
object- build()
- id(id)
- init(init)
- ID = Name(value='id')
- INIT = Name(value='init')
- TYPE_ = Name(value='hydra.typeScript.syntax.VariableDeclarator')
- static builder()
- with_id(id)
- with_init(init)
- class hydra.type_script.syntax.VariableKind(*values)
Bases:
EnumThe kind of variable declaration.
- CONST = Name(value='const')
- LET = Name(value='let')
- TYPE_ = Name(value='hydra.typeScript.syntax.VariableKind')
- VAR = Name(value='var')
- class hydra.type_script.syntax.WhileStatement(test: Expression, body: Statement)
Bases:
objectA while statement.
- BODY = Name(value='body')
- class Builder(_test: 'Expression' = None, _body: 'Statement' = None)
Bases:
object- body(body)
- build()
- test(test)
- TEST = Name(value='test')
- TYPE_ = Name(value='hydra.typeScript.syntax.WhileStatement')
- static builder()
- test: Expression
- with_body(body)
- with_test(test)