Skip to content

docs: add missing built-in utility examples in API documentation#211

Open
ncthuc2004 wants to merge 2 commits into
piotrwitek:masterfrom
ncthuc2004:ncthuc2004-patch-2
Open

docs: add missing built-in utility examples in API documentation#211
ncthuc2004 wants to merge 2 commits into
piotrwitek:masterfrom
ncthuc2004:ncthuc2004-patch-2

Conversation

@ncthuc2004

@ncthuc2004 ncthuc2004 commented May 13, 2026

Copy link
Copy Markdown

Summary

  • add missing examples for built-in utility types: Partial, Readonly, ReturnType, and InstanceType
  • keep example style aligned with existing README API sections

Context

This addresses the IssueHunt-funded docs improvement request in #51.

Testing

  • docs-only change

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds usage examples for the Partial, Readonly, ReturnType, and InstanceType utility types in the README.md. The review feedback suggests improving consistency with existing documentation by reusing type names in examples and ensuring consistent semicolon usage within object literals.

Comment thread README.md Outdated
Comment on lines +697 to +700
type Props = { name: string; age: number; visible: boolean };

// Expect: { name?: string; age?: number; visible?: boolean; }
type PartialProps = Partial<Props>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with other shallow transformation utilities in this documentation (such as Pick, Omit, Optional, and Required), it is recommended to re-use the Props type name for the result instead of introducing PartialProps. Additionally, adding a trailing semicolon to the object literal properties aligns with the style used in the Optional and Required sections.

Suggested change
type Props = { name: string; age: number; visible: boolean };
// Expect: { name?: string; age?: number; visible?: boolean; }
type PartialProps = Partial<Props>;
type Props = { name: string; age: number; visible: boolean; };
// Expect: { name?: string; age?: number; visible?: boolean; }
type Props = Partial<Props>;

Comment thread README.md Outdated
Comment on lines +731 to +734
type Props = { name: string; age: number; visible: boolean };

// Expect: { readonly name: string; readonly age: number; readonly visible: boolean; }
type ReadonlyProps = Readonly<Props>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Similar to the Partial example, using the Props type name for the result and adding a trailing semicolon to the object literal properties would maintain consistency with other shallow transformation utilities like Pick, Omit, Optional, and Required elsewhere in the README.

Suggested change
type Props = { name: string; age: number; visible: boolean };
// Expect: { readonly name: string; readonly age: number; readonly visible: boolean; }
type ReadonlyProps = Readonly<Props>;
type Props = { name: string; age: number; visible: boolean; };
// Expect: { readonly name: string; readonly age: number; readonly visible: boolean; }
type Props = Readonly<Props>;

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.

1 participant