-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(isolated-declarations): shrink span for arrow function that need…
…s an explicit return type
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
crates/oxc_isolated_declarations/tests/fixtures/arrow-function-return-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function A() { | ||
return () => { | ||
return C; | ||
} | ||
} | ||
|
||
const B = () => { return B }; | ||
|
||
const C = function () {} |
38 changes: 38 additions & 0 deletions
38
crates/oxc_isolated_declarations/tests/snapshots/arrow-function-return-type.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/arrow-function-return-type.ts | ||
--- | ||
==================== .D.TS ==================== | ||
|
||
declare function A(): unknown; | ||
declare const B: unknown; | ||
declare const C: unknown; | ||
|
||
|
||
==================== Errors ==================== | ||
|
||
x Function must have an explicit return type annotation with | ||
| --isolatedDeclarations. | ||
,-[2:10] | ||
1 | function A() { | ||
2 | return () => { | ||
: ^^^^^^^ | ||
3 | return C; | ||
`---- | ||
x Function must have an explicit return type annotation with | ||
| --isolatedDeclarations. | ||
,-[7:11] | ||
6 | | ||
7 | const B = () => { return B }; | ||
: ^^^^^^^ | ||
8 | | ||
`---- | ||
|
||
x Function must have an explicit return type annotation with | ||
| --isolatedDeclarations. | ||
,-[9:20] | ||
8 | | ||
9 | const C = function () {} | ||
: ^ | ||
`---- |