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

Add RequiredDeep type #401

Closed
wants to merge 6 commits into from

Conversation

ilchenkoArtem
Copy link

@ilchenkoArtem ilchenkoArtem commented May 29, 2022

Fixes #273

@jmike
Copy link
Contributor

jmike commented Jun 2, 2022

note: the issue linked in the PR description points to the contribution guidelines instead of an actual issue. Is this by mistake?

@baoshan
Copy link

baoshan commented Jun 2, 2022

It’s this issue I think.

@ilchenkoArtem
Copy link
Author

note: the issue linked in the PR description points to the contribution guidelines instead of an actual issue. Is this by mistake?

sorry(( wrong link

@ilchenkoArtem
Copy link
Author

It’s this issue I think.

Yes you are right

? ReadonlyMap<RequiredDeep<KeyType>, RequiredDeep<ValueType>>
: E extends ReadonlySet<infer ItemType>
? ReadonlySet<RequiredDeep<ItemType>>
: E extends (arg: any[]) => unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is a small typo here, this type will only match functions with a single array argument. From my (limited) testing it should actually be : E extends (...arg: any[]) => unknown to match all types of function args.

Copy link
Owner

Choose a reason for hiding this comment

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

@ilchenkoArtem Make sure you add a test for this too.

Copy link
Author

Choose a reason for hiding this comment

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

I wil fix this it this week

@sindresorhus
Copy link
Owner

Make sure you look at our existing "deep" types and that this new types handles all the cases handled by them.

For example,

type HasMultipleCallSignatures<T extends (...arguments: any[]) => unknown> =

type ExcludeUndefined<T> = Exclude<T, undefined>;

/**
Create a type from another type with all keys and nested keys set to optional.
Copy link
Owner

Choose a reason for hiding this comment

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

Make sure the docs are correct.

interface FooRequired {
baz: string;
bar: {
function: (...args: any[]) => void;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
function: (...args: any[]) => void;
function: (...arguments: any[]) => void;

Copy link

Choose a reason for hiding this comment

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

The term arguments is not allowed when TypeScript is in strict mode anymore, if it ever way.

@sindresorhus
Copy link
Owner

CI is failing

}
```

@category Utilities
Copy link
Owner

Choose a reason for hiding this comment

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

@category Object
@category Array
@category Set
@category Map

@sindresorhus
Copy link
Owner

Friendly bump :)

@ilchenkoArtem
Copy link
Author

Friendly bump :)

soory, I am not having time now(( I am having a lot of work(

@sindresorhus
Copy link
Owner

Closing for lack of activity.

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.

Proposal: RequiredDeep
7 participants