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

Typescript props and propTypes mismatched #57

Open
ardok opened this issue Dec 3, 2020 · 0 comments
Open

Typescript props and propTypes mismatched #57

ardok opened this issue Dec 3, 2020 · 0 comments

Comments

@ardok
Copy link

ardok commented Dec 3, 2020

https://github.com/CezaryDanielNowak/React-dotdotdot/blob/master/src/index.js#L70

Dotdotdot.propTypes = {
  children: PropTypes.node,
  clamp: PropTypes.oneOfType([
    PropTypes.string,
    PropTypes.number,
    PropTypes.bool
  ]).isRequired,
  truncationChar: PropTypes.string,
  useNativeClamp: PropTypes.bool,
  className: PropTypes.string,
  tagName: PropTypes.string
};

https://github.com/CezaryDanielNowak/React-dotdotdot/blob/master/src/index.d.ts#L3

export interface DotdotdotProps extends React.HTMLProps<Dotdotdot> {
  clamp: string | number | 'auto';
  useNativeClamp?: boolean;
  splitOnChars?: string[];
  animate?: boolean;
  truncationChar?: string;
  truncationHTML?: string;
  tagName?: string;

Differences that I could see (TS = TypeScript):

  • clamp in propTypes has bool, but TS does not. It has 'auto' instead.
  • className is missing in TS.
  • truncationHTML is missing in propTypes
  • animate is missing in propTypes.
  • children is missing in TS (I don't know whether we should specify children in TS).

Might miss something, but you get the idea.

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

1 participant