FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Missing property fix by aozgaa · Pull Request #14097 · microsoft/TypeScript · GitHub

Missing property fix - #14097

Merged
Arthur Ozga (aozgaa) merged 8 commits into
microsoft:masterfrom
aozgaa:MissingPropertyFix
Feb 16, 2017
Merged

Missing property fix#14097
Arthur Ozga (aozgaa) merged 8 commits into
microsoft:masterfrom
aozgaa:MissingPropertyFix

Conversation

Copy link
Copy Markdown
Contributor

Implements #13071.

Note that there is considerably more work to do for stubbing out missing methods if we want to do any type inference on the parameters. There are additionally issues with inferring type parameters for the stubbed method from its type arguments.

Thoughts Mohamed Hegazy (@mhegazy) Bill Ticehurst (@billti) Daniel Rosenwasser (@DanielRosenwasser) ?

const binaryExpression = token.parent.parent as BinaryExpression;

const checker = context.program.getTypeChecker();
const widenedType = checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(binaryExpression.right));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you also want to widen it. i.e. null => any

Mohamed Hegazy (mhegazy) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good. just add the getWidenedType call

}]
},
{
description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Add_index_accessor_for_missing_property_0), [token.getText()]),

Daniel Rosenwasser (DanielRosenwasser) Feb 16, 2017
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
  1. "index accessor" -> "index signature"
  2. You either need a test for this fix, or you should get rid of it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

changed and test added

Copy link
Copy Markdown
Contributor

Arthur Ozga (@aozgaa) after merging in master please port this to release-2.2

Arthur Ozga (aozgaa) merged commit 8a5bebe into microsoft:master Feb 16, 2017
Arthur Ozga (aozgaa) deleted the MissingPropertyFix branch June 6, 2017 17:56
Microsoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL