types-first-ui icon indicating copy to clipboard operation
types-first-ui copied to clipboard

v3: Better use of generic default arguments

Open ksaldana1 opened this issue 7 years ago • 0 comments

TS 3.0 introduced a breaking change that changed the behavior of how null & undefined resolve with intersection types.

This breaking change hit us particularly hard because of use of null as a generic default parameter in a few places, including both the app "creator" and the app connector.

As a short-term "hacky" fix, we are continuing to use null as our sentinel value, while handling it explicitly downstream where we intersect our types. This is not sustainable and pretty much just serves as a footgun when working in this codebase.

The longer-term solution is thinking harder about the API and where we land on the inference/explicit declaration spectrum. I believe we have overused generic defaults in the current code base, including places where it could ultimately be inferred.

ksaldana1 avatar Oct 04 '18 17:10 ksaldana1