oxc/crates/oxc_isolated_declarations/tests/snapshots/function-parameters.snap

79 lines
3 KiB
Text

---
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 fooGood([a, b]?: any[]): number;
export declare const fooGood2: ({ a, b }?: object) => number;
export declare function fooGood3({ a, b: [{ c }] }: object): 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;
export declare function fooBad(): number;
export declare const fooBad2: () => number;
export declare function withAny(a: any, b: string): void;
export declare function withUnknown(a: unknown, b: string): void;
==================== Errors ====================
x TS9025: Declaration emit for this parameter requires implicitly adding
| undefined to it's type. This is not supported with --isolatedDeclarations.
,-[18:30]
17 | // Incorrect
18 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { }
: ^^^^^^^^^
19 | export function fnDeclBad2<T>(p: T = [], r2: T): void { }
`----
x TS9025: Declaration emit for this parameter requires implicitly adding
| undefined to it's type. This is not supported with --isolatedDeclarations.
,-[18:41]
17 | // Incorrect
18 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { }
: ^^^^^^^^^^^^^^
19 | export function fnDeclBad2<T>(p: T = [], r2: T): void { }
`----
x TS9025: Declaration emit for this parameter requires implicitly adding
| undefined to it's type. This is not supported with --isolatedDeclarations.
,-[19:31]
18 | export function fnDeclBad<T>(p: T = [], rParam: T = "", r2: T): void { }
19 | export function fnDeclBad2<T>(p: T = [], r2: T): void { }
: ^^^^^^^^^
20 | export function fnDeclBad3<T>(p: T = [], rParam?: T, r2: T): void { }
`----
x TS9025: Declaration emit for this parameter requires implicitly adding
| undefined to it's type. This is not supported with --isolatedDeclarations.
,-[20:31]
19 | export function fnDeclBad2<T>(p: T = [], r2: T): void { }
20 | export function fnDeclBad3<T>(p: T = [], rParam?: T, r2: T): void { }
: ^^^^^^^^^
21 |
`----
x TS9011: Parameter must have an explicit type annotation with
| --isolatedDeclarations.
,-[22:24]
21 |
22 | export function fooBad([a, b] = [1, 2]): number {
: ^^^^^^^^^^^^^^^
23 | return 2;
`----
x TS9011: Parameter must have an explicit type annotation with
| --isolatedDeclarations.
,-[26:25]
25 |
26 | export const fooBad2 = ({a, b} = { a: 1, b: 2 }): number => {
: ^^^^^^^^^^^^^^^^^^^^^^^
27 | return 2;
`----
```