Skip to content

Commit 01a7d98

Browse files
committed
feat(isolated-declarations): shrink span for arrow function that needs an explicit return type
1 parent a739d38 commit 01a7d98

File tree

1 file changed

+5
-2
lines changed
  • crates/oxc_isolated_declarations/src

1 file changed

+5
-2
lines changed

crates/oxc_isolated_declarations/src/types.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use oxc_ast::ast::{
44
TSTypeOperatorOperator,
55
};
66
use oxc_diagnostics::OxcDiagnostic;
7-
use oxc_span::{GetSpan, SPAN};
7+
use oxc_span::{GetSpan, Span, SPAN};
88

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

4343
if return_type.is_none() {
44-
self.error(function_must_have_explicit_return_type(func.span));
44+
self.error(function_must_have_explicit_return_type(Span::new(
45+
func.params.span.start,
46+
func.body.span.start + 1,
47+
)));
4548
}
4649

4750
let params = self.transform_formal_parameters(&func.params);

0 commit comments

Comments
 (0)