-
-
Notifications
You must be signed in to change notification settings - Fork 474
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): treat AssignmentPattern as optional (#3748)
- Loading branch information
Showing
8 changed files
with
88 additions
and
21 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
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
crates/oxc_isolated_declarations/tests/fixtures/function-parameters.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,8 @@ | ||
// Correct | ||
export function fnDeclGood(p: T = [], rParam = ""): void { }; | ||
export function fnDeclGood2(p: T = [], rParam?: number): void { }; | ||
|
||
// Incorrect | ||
export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { } | ||
export function fnDeclBad2<T>(p: T = [], r2: T): void { } | ||
export function fnDeclBad3<T>(p: T = [], rParam?: T, r2: T): void { } |
This file was deleted.
Oops, something went wrong.
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
5 changes: 0 additions & 5 deletions
5
crates/oxc_isolated_declarations/tests/snapshots/complex.snap
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
crates/oxc_isolated_declarations/tests/snapshots/function-parameters.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,49 @@ | ||
--- | ||
source: crates/oxc_isolated_declarations/tests/mod.rs | ||
input_file: crates/oxc_isolated_declarations/tests/fixtures/function-parameters.ts | ||
--- | ||
==================== .D.TS ==================== | ||
|
||
export declare function fnDeclGood(p?: T, rParam?: string): void; | ||
export declare function fnDeclGood2(p?: T, rParam?: number): void; | ||
export declare function fnDeclBad<T>(p: T, rParam: T, r2: T): void; | ||
export declare function fnDeclBad2<T>(p: T, r2: T): void; | ||
export declare function fnDeclBad3<T>(p: T, rParam?: T, r2: T): void; | ||
|
||
|
||
==================== Errors ==================== | ||
|
||
x Declaration emit for this parameter requires implicitly adding undefined | ||
| to it's type. This is not supported with --isolatedDeclarations. | ||
,-[6:30] | ||
5 | // Incorrect | ||
6 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { } | ||
: ^^^^^^^^^ | ||
7 | export function fnDeclBad2<T>(p: T = [], r2: T): void { } | ||
`---- | ||
x Declaration emit for this parameter requires implicitly adding undefined | ||
| to it's type. This is not supported with --isolatedDeclarations. | ||
,-[6:41] | ||
5 | // Incorrect | ||
6 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { } | ||
: ^^^^^^^^^^^^^^ | ||
7 | export function fnDeclBad2<T>(p: T = [], r2: T): void { } | ||
`---- | ||
x Declaration emit for this parameter requires implicitly adding undefined | ||
| to it's type. This is not supported with --isolatedDeclarations. | ||
,-[7:31] | ||
6 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { } | ||
7 | export function fnDeclBad2<T>(p: T = [], r2: T): void { } | ||
: ^^^^^^^^^ | ||
8 | export function fnDeclBad3<T>(p: T = [], rParam?: T, r2: T): void { } | ||
`---- | ||
x Declaration emit for this parameter requires implicitly adding undefined | ||
| to it's type. This is not supported with --isolatedDeclarations. | ||
,-[8:31] | ||
7 | export function fnDeclBad2<T>(p: T = [], r2: T): void { } | ||
8 | export function fnDeclBad3<T>(p: T = [], rParam?: T, r2: T): void { } | ||
: ^^^^^^^^^ | ||
`---- |
This file was deleted.
Oops, something went wrong.