Skip to content

Commit

Permalink
feat(isolated-declarations): shrink span for arrow function that need…
Browse files Browse the repository at this point in the history
…s an explicit return type
  • Loading branch information
Dunqing committed Jun 19, 2024
1 parent 85f8c8a commit 92111b8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/oxc_isolated_declarations/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use oxc_ast::ast::{
TSTypeOperatorOperator,
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_span::{GetSpan, SPAN};
use oxc_span::{GetSpan, Span, SPAN};

use crate::{
diagnostics::{
Expand Down Expand Up @@ -41,7 +41,10 @@ impl<'a> IsolatedDeclarations<'a> {
let return_type = self.infer_arrow_function_return_type(func);

if return_type.is_none() {
self.error(function_must_have_explicit_return_type(func.span));
self.error(function_must_have_explicit_return_type(Span::new(
func.params.span.start,
func.body.span.start + 1,
)));
}

let params = self.transform_formal_parameters(&func.params);
Expand Down

0 comments on commit 92111b8

Please sign in to comment.