-
Notifications
You must be signed in to change notification settings - Fork 663
Fixed contextually typed expando members #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- old.typeFromPropertyAssignment30.types | ||
+++ new.typeFromPropertyAssignment30.types | ||
@@= skipped -8, +8 lines =@@ | ||
} | ||
const c: Combo = () => 1 | ||
>c : Combo | ||
->() => 1 : { (): number; p: {}; } | ||
+>() => 1 : { (): number; p: { [s: string]: number; }; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have not investigated why this is different but I genuinely feel like this is an improvement. It's not even a user-facing - or I don't know how to position my cursor in this example to get such quick info. If we think about types alone then we can test how this behaves if we start assigning properties to interface Combo {
(): number;
p?: { [s: string]: number };
}
const c: Combo = () => 1;
c.p = {};
c.p.testOk = 1; // ok
c.p.testError = "foo"; // error So it's not really correct, in my eyes, to say that If I get the
|
||
>1 : 1 | ||
|
||
// should not be an expando object, but contextually typed by Combo.p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ports Strada's
mergeJSSymbols
- but since JS is not really involved here right now, I decided to just inline its relevant parts here (at least for the time being)