Skip to content

Instantly share code, notes, and snippets.

@wildeyes
Last active September 27, 2017 07:48
Show Gist options
  • Save wildeyes/e62dde6a091798e31385f1f332e61df2 to your computer and use it in GitHub Desktop.
Save wildeyes/e62dde6a091798e31385f1f332e61df2 to your computer and use it in GitHub Desktop.
How to annotate X in typescript
// The Typescript language spec, https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md, is the definitive guide for
// how to annotate a react class, or anything else. But, sometimes, examples with a lot of SEO compatible words is better.
// Annotate a decorator that takes a react class, and wraps it. It'll have the same props as it's child.
export const decorateWithX = <T extends {}>(Comp: ComponentClass<T>): ComponentClass<T> => class extends PureComponent<T, State> {
}
// https://github.com/Microsoft/TypeScript/issues/4922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment