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

PartialDeep: Ensure it doesn't recurse into prototype properties #738

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

Emiyaaaaa
Copy link
Collaborator

@Emiyaaaaa Emiyaaaaa changed the title partialDeep: Ensure it doesn't recurse into prototype properties PartialDeep: Ensure it doesn't recurse into prototype properties Nov 2, 2023
@sindresorhus sindresorhus merged commit 5eeac02 into sindresorhus:main Nov 2, 2023
6 checks passed
@sindresorhus
Copy link
Owner

Can you check if we need to do this to any of the other deep types?

@Emiyaaaaa
Copy link
Collaborator Author

Can you check if we need to do this to any of the other deep types?

Sure

? Options['recurseIntoArrays'] extends true
? ItemType[] extends T // Test for arrays (non-tuples) specifically
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
? ReadonlyArray<PartialDeep<ItemType | undefined, Options>>
: Array<PartialDeep<ItemType | undefined, Options>>
: PartialObjectDeep<T, Options> // Tuples behave properly
: T // If they don't opt into array testing, just use the original type
: PartialObjectDeep<T, Options>
: unknown;
: T;
Copy link

Choose a reason for hiding this comment

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

I think this should be PartialObjectDeep<T, Options> - otherwise it's no longer deep.

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.

PartialDeep should skip HTMLCanvasElement
3 participants