Skip to content

Commit

Permalink
adds patch test to make sure replacing an optional prop with a type…
Browse files Browse the repository at this point in the history
… that contains an optional prop doesn't interfere with the base case
  • Loading branch information
ahrjarrett committed Nov 20, 2023
1 parent c97f517 commit 2a593da
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test-d/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,33 @@ declare namespace T_13 {

expectType<typeof T_13.output>(patch(T_13.input, T_13.config))
expectType<ReturnType<typeof patch<typeof T_13.input, typeof T_13.config>>>(T_13.output)

declare namespace T_14 {
const input: typeof arrange.input
const config: { replaceWith: { NEW?: 1 }, maxDepth: -1 }
const output: {
a: { b: 1; };
f:
| { NEW?: 1 | undefined; }
| { g: 2; };
j: {
k:
| 3
| { NEW?: 1 | undefined; };
};
m:
| {
NEW?:
| 1
| undefined;
}
| {
n:
| 4
| { NEW?: 1 | undefined; };
};
}
}

expectType(patch(T_14.input, T_14.config))
expectType<ReturnType<typeof patch<typeof T_14.input, typeof T_14.config>>>(T_14.output)

0 comments on commit 2a593da

Please sign in to comment.