Skip to content

Instantly share code, notes, and snippets.

@didi0613
Last active June 19, 2018 20:07
Show Gist options
  • Save didi0613/0c8b26ebbde1c93689d1993829072221 to your computer and use it in GitHub Desktop.
Save didi0613/0c8b26ebbde1c93689d1993829072221 to your computer and use it in GitHub Desktop.
Flow type checker frequent ask

Flow type checker frequent ask

Below are the issues that frequently being ask, you can update them if you see any similar issue:

- Cannot assign this.handlerFunction.bind(...) to this.handlerFunction because property handlerFunction is not writable.

Update this.handlerFunction = this.handlerFunction.bind(this);

to (this:any).handlerFunction = this.handlerFunction.bind(this);

- How to use EventTarget?

Declare type by

declare type ElementEventTemplate<E> = {
   target: E
 } & Event;

declare type InputEvent = ElementEventTemplate<HTMLInputElement>;

- How to add Type for function callbacks

function method(callback: (error: Error | null, value: string | null) => void) {
 // ...
}
@datvong-wm
Copy link

Should move to electrode-dev-guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment