Skip to content

Commit

Permalink
Use "as" to prevent TS from auto-narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
sstur committed Mar 5, 2023
1 parent c54739a commit 73df554
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests/json-stringify.ts
Expand Up @@ -23,7 +23,7 @@ doNotExecute(() => {
});

doNotExecute(() => {
const value: null | string | number | boolean | object | Array<any> = null;
const value = null as null | string | number | boolean | object | any[];
const result = JSON.stringify(value);
type tests = [Expect<Equal<typeof result, string>>];
});

0 comments on commit 73df554

Please sign in to comment.