Skip to content
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

Fix declaration emit for property references of imported object literal types #39055

Merged
merged 2 commits into from
Jun 13, 2020

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Jun 12, 2020

Fixes #38516

There were two problems:

  1. There was code to handle the special case of swapping the symbol for an object literal for the symbol of its variable declaration, but that logic did not handle type literals, as you’d find in a declaration file. I extended it to look at type literals as well.
  2. That code was only run when determining symbol accessibility, not when actually looking up the symbol chain. So I moved it into getContainersOfSymbol.

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Nice. Can we also add a test dedicated to testing the declaration file case?

@andrewbranch
Copy link
Member Author

Oh, sure. I actually forgot the test I used was a normal .ts file since it was an ambient declaration nonetheless. But I’ll add on to that test.

@andrewbranch andrewbranch merged commit b63ea4b into microsoft:master Jun 13, 2020
@andrewbranch andrewbranch deleted the bug/38516 branch June 13, 2020 00:48
cangSDARM added a commit to cangSDARM/TypeScript that referenced this pull request Jun 15, 2020
* upstream/master: (22 commits)
  Small fix in `getIsContextSensitiveAssignmentOrContextType`
  Simplify `visitObjectLiteralExpression`
  Fix handling of `aruments` in the emitter
  Fix declaration emit for property references of imported object literal types (microsoft#39055)
  Fix casing for wild card keys for implicit globs to get wild card directories to watch (microsoft#39049)
  DOM update 2020-06-12
  fix(a11y): make ISSUE_TEMPLATE/Bug_report.md more accessible for folks with screen readers (microsoft#39013)
  Update request-pr-review script to latest version of octokit (microsoft#39031)
  pin version of octokit
  skip implements types with no symbols
  isDynamicName skips parentheses for element access
  Allow `e: unknown` in `catch` arguments
  Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters (microsoft#38982)
  Patch to use this.timeout() > 0 rather than this.enableTimeout() to work with mocha 8+
  Handle missing return type nodes and nested type references missing type arguments in existing jsdoc node serialization (microsoft#39011)
  Add containerName to CallHierarchyItem (microsoft#38997)
  Fix isSameEntityName (microsoft#38999)
  Fix typo for 'blocklist' (microsoft#39001)
  remove errant tab
  Switch to isSymbolAccessible for both.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unique symbol type imported in declaration files used as computed property key can not be named
3 participants