Improve README utility examples#208
Conversation
|
Follow-up for maintainers: after opening this I noticed IssueHunt lists #207, which did not appear in my earlier GitHub PR search. I kept this PR scoped to additional README gaps and snippet fixes that are not covered by #207, rather than duplicating its Record/Parameters/ConstructorParameters additions. If you prefer these to be consolidated into the other PR, I am happy to close this one. |
There was a problem hiding this comment.
Code Review
This pull request updates the README.md by adding usage examples for several utility types, including NonNullable, NonUndefined, Exclude, Extract, Partial, Readonly, ReturnType, and InstanceType. It also corrects existing examples for ValuesType, Mutable, UnionToIntersection, and Class to ensure they are syntactically valid and consistent. The review feedback suggests aligning the NonUndefined example with the NonNullable example by using the same base union type to improve clarity and comparability.
| import { NonUndefined } from 'utility-types'; | ||
|
|
||
| // Expect: string | null | ||
| type NonUndefinedName = NonUndefined<string | null | undefined>; |
There was a problem hiding this comment.
While this example is correct, it is slightly inconsistent with the NonNullable example above (line 303) which uses string | number | null | undefined. For better clarity and easier comparison between NonNullable and NonUndefined, consider using the same base union type in both examples.
| import { NonUndefined } from 'utility-types'; | |
| // Expect: string | null | |
| type NonUndefinedName = NonUndefined<string | null | undefined>; | |
| import { NonUndefined } from 'utility-types'; | |
| // Expect: string | number | null | |
| type NonUndefinedName = NonUndefined<string | number | null | undefined>; |
|
Addressed the review note by aligning the Validation: |
Summary
Fixes #51
Validation
Transparency
I used AI assistance to identify documentation gaps, draft the README-only changes, and review the diff. I manually checked the final patch and validation output before submitting.
Funded issue
IssueHunt Summary
Referenced issues
This pull request has been submitted to: