Commit graph

5 commits

Author SHA1 Message Date
Dunqing
8780c5440f fix(isolated-declarations): do not union a undefined when the param type is any or unknown (#5930) 2024-09-20 15:12:01 +00:00
overlookmotel
dc924892cc test: add trailing line breaks to conformance fixtures (#5541)
Continuation of #5537. Ensure all conformance fixture files have a trailing line break.
2024-09-06 12:55:17 +00:00
michaelm
3fcad5e16f
fix(isolated_declarations): Remove nested AssignmentPatterns from inside parameters (#4077)
The default values in destructured parameters are retained in
declarations, which can cause captured variables to be part of the emit
when they shouldn't be. This can also lead to unnecessary isolated
declaration errors when those variables are themselves missing type
annotations and can't be inferred.

For example:
```ts
const x = 42;
const y = '';
export function fooGood3({a = x, b: [{c = y}]}: object): void {}
```

before this change will be emitted as:
```ts
declare const x = 42;
declare const y = '';
export declare function fooGood3({ a = x, b: [{ c = y }] }: object): void;
```

and after this change will be emitted as:
```ts
export declare function fooGood3({ a, b: [{ c }] }: object): void;
```

Co-authored-by: MichaelMitchell-at <=>
2024-07-08 11:06:26 +08:00
Dunqing
58e54f4aea fix(isolated-declarations): report an error for parameters if they are ObjectPattern or ArrayPattern without an explicit type (#3810) 2024-06-21 10:20:28 +00:00
Dunqing
9ea30c41ff feat(isolated-declarations): treat AssignmentPattern as optional (#3748) 2024-06-19 14:05:59 +00:00