feat: adding generator to js/ts/tsx and improvements for ts (#234)

* feat: adding generator to js/ts/tsx and improvements for ts

* reverting tests
This commit is contained in:
Miguel Oliva 2023-03-25 20:04:56 -03:00 committed by GitHub
parent 3a48e2d3c9
commit fc7db28056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 4 deletions

View file

@ -10,6 +10,7 @@
(expression_statement)
(for_statement)
(function_declaration)
(generator_function_declaration)
(jsx_element)
(jsx_self_closing_element)
(lexical_declaration)

View file

@ -3,13 +3,11 @@
) @context
([
(arrow_function)
(call_expression)
(class_declaration)
(else_clause)
(expression_statement)
(for_statement)
(function_declaration)
(interface_declaration)
(jsx_element)
(jsx_self_closing_element)
@ -19,3 +17,15 @@
(pair)
(while_statement)
] @context)
(arrow_function
body: (_ (_) @context.end)
) @context
(function_declaration
body: (_ (_) @context.end)
) @context
(generator_function_declaration
body: (_ (_) @context.end)
) @context

View file

@ -3,13 +3,11 @@
) @context
([
(arrow_function)
(call_expression)
(class_declaration)
(else_clause)
(expression_statement)
(for_statement)
(function_declaration)
(interface_declaration)
(lexical_declaration)
(method_definition)
@ -17,3 +15,15 @@
(pair)
(while_statement)
] @context)
(arrow_function
body: (_ (_) @context.end)
) @context
(function_declaration
body: (_ (_) @context.end)
) @context
(generator_function_declaration
body: (_ (_) @context.end)
) @context

View file

@ -44,6 +44,19 @@ function wrapInArray(obj: string | string[]) {
}
return obj;
}
function* wrapInArray2(
obj: string | string[]):
string[] {
if (typeof obj === "string") {
return [obj];
}
return obj;
}