exactOptionalPropertyTypes
This option makes a distinction between an optional property being not defined, and that property being explicitly set to undefined
.
For example:
ts
type SearchQuery = {
query: string;
filters?: Filter[];
};
it("defaults to empty filter list", () => {
search({
query: "asdf",
// If exactOptionalPropertyTypes was set, this would throw in tsc
filters: undefined,
});
});