Created
March 27, 2018 23:29
-
-
Save gaearon/88634d27abbc4feeb40a698f760f3264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example extends React.Component< | |
Props, | |
State, | |
Snapshot | |
> { | |
static getDerivedStateFromProps( | |
nextProps: Props, | |
prevState: State | |
): $Shape<State> | null { | |
// ... | |
} | |
getSnapshotBeforeUpdate( | |
prevProps: Props, | |
prevState: State | |
): Snapshot { | |
// ... | |
} | |
} |
@geekf it's Flow
Replace $Shape
with Partial
and you have typescript, though.
@simonbuchan just wondering... will Flow and Typescript merge?
This is Flow
How to define Snapshot?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stupid question, but is this TypeScript? The file extensions says
.js
.