Skip to content

Conversation

@Andarist
Copy link
Contributor

I've noticed that the #50044 didn't introduce a new test related to the issue that it closed and I've figured out that it might be nice to add it

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jul 27, 2022
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

Comment on lines 8 to 22
declare const obj1: {};
obj1; // {}
if (isObject(obj1)) {
obj1; // Record<string, unknown>
obj1['attr'];
}
obj1; // Record<string, unknown>

declare const obj2: {} | undefined;
obj2; // {} | undefined
if (isObject(obj2)) {
obj2; // Record<string, unknown>
obj2['attr'];
}
obj2; // Record<string, unknown> | undefined
Copy link
Member

Choose a reason for hiding this comment

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

I know it's unfair to ask this of you since there were no tests, but:

  • I would remove the comments - the type baselines and errors will indicate these better and not need to be updated.
  • I would also add test cases for a type predicate like value is {} acting on Record<string, unknown> and Record<string, unknown> | undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem - I've added the requested test cases and removed those comments (I've originally kept them as they are pretty popular in your test suite)

Copy link
Member

@DanielRosenwasser DanielRosenwasser Jul 29, 2022

Choose a reason for hiding this comment

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

I've originally kept them as they are pretty popular in your test suite

Yeah, I am not a fan 😅

They fall out of date with the baselines so it never made sense.

@DanielRosenwasser DanielRosenwasser merged commit 5374fd9 into microsoft:main Jul 29, 2022
@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.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants