Anton Strogonoff
Anton Strogonoff

Reputation: 34032

What language is Facebook’s Flux written in, and how does it get transpiled to JavaScript?

Here is Dispatcher.js inside the Flux repository. Despite filename extension it’s not JavaScript.

For example, it uses types:

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

Can someone help me determine what language is it written in and where exactly does its ‘transpilation’ to JavaScript happen?

I see mentions of Babel in the gulpfile and among package dependencies, but Babel seems to work with ES2015 by default, which isn’t the language of Dispatcher.js.

Upvotes: 0

Views: 204

Answers (1)

Mark Rousskov
Mark Rousskov

Reputation: 971

The file is written in ES6 (which is JavaScript).

The type system that you see is Flow. It's simply an addition to JavaScript, not really another language.

Babel can strip Flow types and transpile ES6 to JavaScript (which it will do by default).

Upvotes: 3

Related Questions