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

Find a more native way to augment the React Classes Typescript definitions #83

Open
vzaidman opened this issue Jan 25, 2020 · 0 comments
Labels
blocked by an issue in another library Waiting for an issue in another library to be solved enhancement New feature or request

Comments

@vzaidman
Copy link
Collaborator

vzaidman commented Jan 25, 2020

currently we use

declare namespace React {
  namespace Component {
    const whyDidYouRender: WhyDidYouRender.WhyDidYouRenderComponentMember;
  }
}

and it actually works with

class ClassComponentWithBooleanWDYR extends React.Component<Props>{
  static whyDidYouRender = true
  ...

or

class ClassComponentWithObjWDYR extends React.Component<Props>{
  static whyDidYouRender = {collapseGroups: true}
  ...

in the latest version but it's not entirely clear to me just how it works :)

the preferred solutions would be something like:

  class Component<P, S> {
    whyDidYouRender?: WhyDidYouRender.WhyDidYouRenderComponentMember;
  }

if microsoft/TypeScript#32185 is implemented
or any other approach to augmentation of class components with static members:
microsoft/TypeScript#33892, microsoft/TypeScript#34516

@vzaidman vzaidman added blocked by an issue in another library Waiting for an issue in another library to be solved enhancement New feature or request labels Jan 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by an issue in another library Waiting for an issue in another library to be solved enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant