GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Write more useful types in `.types` test outputs by rbuckton · Pull Request #48578 · microsoft/TypeScript

Conversation

@rbuckton

@rbuckton Ron Buckton (rbuckton) commented Apr 5, 2022

Copy link
Copy Markdown
Contributor

#42149 and #42284 improved what we display to users when presenting complex type aliases, but this had the downside of making hundreds of .types test outputs mostly useless, as numerous test outputs would now report T : T for the type of a type alias, when we were actually using those results to validate the expected type.

This changes the type writer we use to generate .types tests to compare the stringified type to the name of the type alias and, if they match, to re-stringify the type without using its name (by passing TypeFormatFlags.InTypeAlias to typeToString).

This change makes over a thousand individual tests across over 427 .tests files useful again.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sheetalkamat reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@rbuckton
Write more useful types in .types test outputs
07c949e
@rbuckton
Ron Buckton (rbuckton) requested review from Ryan Cavanaugh (RyanCavanaugh), Nathan Shively-Sanders (sandersn) and Wesley Wigham (weswigham) April 5, 2022 22:50
@typescript-bot TypeScript Bot (typescript-bot) assigned Ron Buckton (rbuckton) Apr 5, 2022
@typescript-bot TypeScript Bot (typescript-bot) added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 5, 2022
@rbuckton
Ron Buckton (rbuckton) requested a review from Sheetal Nandi (sheetalkamat) April 6, 2022 23:20
@jakebailey

Jake Bailey (jakebailey) commented Apr 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

With this change in place, how are PRs like the above ones tested/verified to still be working in the future? The two linked PRs are all code changes + .types files, where people noted the improvement, but there doesn't seem to be a file that is sorta-kinda "what the user sees". Presumably, if this change had been in place before those two PRs, they wouldn't have really had much in the way of diffs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rbuckton

Ron Buckton (rbuckton) commented Apr 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

The type we use for what the user sees can be verified when it's used in other places. The user never sees SomeType when hovering over type SomeType = ... in the editor, because we also ignore the type alias when we generate the quick info.

We also could leverage fourslash tests for things like verifying quickinfo as well. Traditionally, the .types tests are for us to verify the correct types are being produced, not for reporting what the user sees in the editor.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

andrewbranch
Andrew Branch (andrewbranch) approved these changes Apr 7, 2022
View reviewed changes
@rbuckton
Ron Buckton (rbuckton) merged commit b975dfa into main Apr 7, 2022
@rbuckton
Ron Buckton (rbuckton) deleted the fixTypeWriterOutputsForTypeAliases branch April 7, 2022 16:51
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@andrewbranch Andrew Branch (andrewbranch) andrewbranch approved these changes
@sandersn Nathan Shively-Sanders (sandersn) Awaiting requested review from sandersn
@weswigham Wesley Wigham (weswigham) Awaiting requested review from weswigham
@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) Awaiting requested review from RyanCavanaugh
@sheetalkamat Sheetal Nandi (sheetalkamat) Awaiting requested review from sheetalkamat

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rbuckton Ron Buckton (rbuckton)

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rbuckton @jakebailey @andrewbranch @typescript-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.