Skip to content

Fix: Prettify when instantiated with classes containing private/protected members#450

Merged
Beraliv merged 3 commits into
ts-essentials:masterfrom
som-sm:fix/remove-extract-from-prettify
Oct 6, 2025
Merged

Fix: Prettify when instantiated with classes containing private/protected members#450
Beraliv merged 3 commits into
ts-essentials:masterfrom
som-sm:fix/remove-extract-from-prettify

Conversation

@som-sm

@som-sm som-sm commented Oct 5, 2025

Copy link
Copy Markdown
Contributor

PR Checklist

Overview

This PR implements the changes mentioned in #439 (comment).

Comment thread test/prettify.ts Outdated

function testAssignability() {
let assignabilityCheck1: <Type>(arg: Type) => arg is Prettify<Type>;
// let assignabilityCheck2: <Type>(arg: Prettify<Type>) => arg is Type; // This fails currently, but shouldn't ideally

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.

This is something that doesn't work as expected, and it wasn't working even with our existing Extract hack, so it's not something introduced with this change. This needs fixing, but I guess for now we can move ahead without this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it worth uncommenting and adding ts-expect-error just to track the progress? in case it's fixed intentionally or by accident, we can remove ts-expect-error then? wdyt?

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.

Yup, that makes sense. Updated in 5541604.

@Beraliv

Beraliv commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator

Thanks @som-sm, I'll review it later today

@Beraliv Beraliv added the v10.2 label Oct 6, 2025
@Beraliv Beraliv self-requested a review October 6, 2025 13:00

@Beraliv Beraliv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for raising this PR! Agreed that it is better than previous solution! Once agreed on https://github.com/ts-essentials/ts-essentials/pull/450/files#r2404546847, happy to get it merged

@Beraliv Beraliv merged commit afa25a9 into ts-essentials:master Oct 6, 2025
18 checks passed
@Beraliv Beraliv mentioned this pull request Oct 6, 2025
5 tasks
@som-sm som-sm changed the title fix: Prettify when instantiated with classes containing private/protected members Fix: Prettify when instantiated with classes containing private/protected members Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants