Leo Jiang
Leo Jiang

Reputation: 26085

What is this syntax used in Facebook's dispatcher.js?

class Dispatcher<TPayload> {
  _callbacks: {[key: DispatchToken]: (payload: TPayload) => void}
  ...

It looks like TypeScript, but I'm able to compile it using Babel without TypeScript. I couldn't find anything about this in ES6 or ES7. What is this syntax called?

Upvotes: 0

Views: 51

Answers (1)

Jonny Buchanan
Jonny Buchanan

Reputation: 62793

These are flow annotations, it's Facebook's own type checker.

Upvotes: 1

Related Questions