Repository navigation
Negated Types: Constrain Promise<T> to forbid Thenable T - #65010
Wesley Wigham (weswigham) wants to merge 24 commits into
Conversation
…t literal handling
Deduplicate fresh negations against their regular counterparts during union collection and intersection insertion. Preserve the first intersection position and ordered-set membership when replacing a fresh member, while leaving standalone fresh negations eligible for widening. Add compiler coverage for explicit exclusions, generic array narrowing, both union operand orders, and fresh-only widening.
…ntial structures, broaden negation reduction applicability
|
TypeScript Bot (@typescript-bot) test this There's gonna be a lot. |
|
Hey Wesley Wigham (@weswigham), something went wrong when publishing results from the DT run. |
|
Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing Something interesting changed - please have a look. Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d5b15ba to
59e27bc
Compare
|
Experiment done, work will continue in #64375 - this is just hilariously breaky because declare global {
interface Promise<T extends not {then(): any}> {}
}or similar (if you think a different constraint works better) to your own codebase. If you think you land on "the perfect one" that works today, let us know - we think |
This is breaking like you would not believe. Not because an unconstrained and constrained
Promisewon't merge - we already allow that for interfaces - no - becausePromise<string>isn't a valid instantiation because you can, pathologically, assign astring & {then(): number}tostring, meaningstring(and all primitives) is possibly thenable.This is the kind of break that, while it looks really good for object type safety, actually falls apart in the primitives - and looks like it wants us to forbid primitive intersections (or at least intersected methods) to get it to work without being too bad.
Hypothetically, closed object types would also make this much less breaking.