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

$ReadOnly<T> has a typo in its documentation #156

Closed
cyli2014 opened this issue Oct 24, 2020 · 3 comments
Closed

$ReadOnly<T> has a typo in its documentation #156

cyli2014 opened this issue Oct 24, 2020 · 3 comments

Comments

@cyli2014
Copy link
Contributor

cyli2014 commented Oct 24, 2020

Description

The documentation for $ReadOnly<T> seems to have a typo.

import { $ReadOnly } from 'utility-types';

type Props = { name: string; age: number; visible: boolean };

// Expect: Readonly<{ name: string; age?: number | undefined; visible: boolean; }>
type ReadOnlyProps = $ReadOnly<Props>;

The example shows that age is converted to an optional property after being applied $ReadOnly. I thinks it's a typo because age should be an ordinary readonly property just like name and visible.

Steps to Reproduce

  1. Refer to $ReadOnly in README.md

Expected Behavior

import { $ReadOnly } from 'utility-types';

type Props = { name: string; age: number; visible: boolean };

// Expect: Readonly<{ name: string; age: number; visible: boolean; }>
type ReadOnlyProps = $ReadOnly<Props>;

Suggested Solution(s)

Modify the documentation in README.md and comments in utility-types.ts

Project Dependencies

  • Utility-Types Version: 3.10.0

Environment (optional)

  • Browser and Version: XXX
  • OS: XXX
  • Node Version: XXX
  • Package Manager and Version: XXX
@cyli2014
Copy link
Contributor Author

BTW, some npm scripts don't work well on Windows. Any plan for compatibility?

@piotrwitek
Copy link
Owner

You're right, thanks for the fix!

I'm not using windows so I cannot help, but if you can add Windows compatibility it would be great!

@cyli2014
Copy link
Contributor Author

Gotcha. Will look into it if time permits. Thanks!

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

No branches or pull requests

2 participants