diff --git a/crates/oxc_parser/src/js/arrow.rs b/crates/oxc_parser/src/js/arrow.rs index b7419df8e7fb6..e6ff942427d03 100644 --- a/crates/oxc_parser/src/js/arrow.rs +++ b/crates/oxc_parser/src/js/arrow.rs @@ -22,7 +22,7 @@ impl<'a, C: Config> ParserImpl<'a, C> { match self.is_parenthesized_arrow_function_expression() { Tristate::False => None, Tristate::True => Some(self.parse_parenthesized_arrow_function_expression( - /* allow_return_type_in_arrow_function */ true, + allow_return_type_in_arrow_function, )), Tristate::Maybe => self.parse_possible_parenthesized_arrow_function_expression( allow_return_type_in_arrow_function, diff --git a/tasks/coverage/misc/pass/conditional-arrow-alternate-return-type.ts b/tasks/coverage/misc/pass/conditional-arrow-alternate-return-type.ts new file mode 100644 index 0000000000000..6e4bb4ab66fed --- /dev/null +++ b/tasks/coverage/misc/pass/conditional-arrow-alternate-return-type.ts @@ -0,0 +1,16 @@ +const formErrors = { foo: 'bar' }; + +type Form = { id: number; errors: Record }; + +type Errors = Pick; + +type FooBarForm = Form & { tag: 'foobarform' }; + +const getFormError = + typeof formErrors !== 'object' + ? () => ({}) + : (index: number): Errors => { + return { + errors: { a: true, b: false }, + }; + }; diff --git a/tasks/coverage/snapshots/codegen_misc.snap b/tasks/coverage/snapshots/codegen_misc.snap index e8cc6977d765c..e50492d12fe1b 100644 --- a/tasks/coverage/snapshots/codegen_misc.snap +++ b/tasks/coverage/snapshots/codegen_misc.snap @@ -1,3 +1,3 @@ codegen_misc Summary: -AST Parsed : 64/64 (100.00%) -Positive Passed: 64/64 (100.00%) +AST Parsed : 65/65 (100.00%) +Positive Passed: 65/65 (100.00%) diff --git a/tasks/coverage/snapshots/formatter_misc.snap b/tasks/coverage/snapshots/formatter_misc.snap index 420c9be986ebe..c08ca62d32f2a 100644 --- a/tasks/coverage/snapshots/formatter_misc.snap +++ b/tasks/coverage/snapshots/formatter_misc.snap @@ -1,3 +1,3 @@ formatter_misc Summary: -AST Parsed : 64/64 (100.00%) -Positive Passed: 64/64 (100.00%) +AST Parsed : 65/65 (100.00%) +Positive Passed: 65/65 (100.00%) diff --git a/tasks/coverage/snapshots/parser_misc.snap b/tasks/coverage/snapshots/parser_misc.snap index 1553977ab4539..2b51317fe2d8d 100644 --- a/tasks/coverage/snapshots/parser_misc.snap +++ b/tasks/coverage/snapshots/parser_misc.snap @@ -1,6 +1,6 @@ parser_misc Summary: -AST Parsed : 64/64 (100.00%) -Positive Passed: 64/64 (100.00%) +AST Parsed : 65/65 (100.00%) +Positive Passed: 65/65 (100.00%) Negative Passed: 134/134 (100.00%) × Cannot assign to 'arguments' in strict mode diff --git a/tasks/coverage/snapshots/semantic_misc.snap b/tasks/coverage/snapshots/semantic_misc.snap index 24cc316c513c2..759f999c7c8ca 100644 --- a/tasks/coverage/snapshots/semantic_misc.snap +++ b/tasks/coverage/snapshots/semantic_misc.snap @@ -1,6 +1,11 @@ semantic_misc Summary: -AST Parsed : 64/64 (100.00%) -Positive Passed: 51/64 (79.69%) +AST Parsed : 65/65 (100.00%) +Positive Passed: 51/65 (78.46%) +semantic Error: tasks/coverage/misc/pass/conditional-arrow-alternate-return-type.ts +Unresolved references mismatch: +after transform: ["Pick", "Record"] +rebuilt : [] + semantic Error: tasks/coverage/misc/pass/declare-let-private.ts Bindings mismatch: after transform: ScopeId(0): ["private"] diff --git a/tasks/coverage/snapshots/transformer_misc.snap b/tasks/coverage/snapshots/transformer_misc.snap index 7ccc8759d7902..1b569262ad10f 100644 --- a/tasks/coverage/snapshots/transformer_misc.snap +++ b/tasks/coverage/snapshots/transformer_misc.snap @@ -1,3 +1,3 @@ transformer_misc Summary: -AST Parsed : 64/64 (100.00%) -Positive Passed: 64/64 (100.00%) +AST Parsed : 65/65 (100.00%) +Positive Passed: 65/65 (100.00%)