Slate: Flow

Created on 27 Jul 2018  路  6Comments  路  Source: ianstormtaylor/slate

Is there any plan to leverage https://flow.org?
It's pretty stable and nice and all, and it would be great to have autocomplete etc.

How can I help?

question

All 6 comments

So I tried to add Flow to project https://github.com/steida/slate/commit/8139ea3f71f302d508dd91e662f7189af4ed688e

Realizing there are no straightforward docs for Workspaces with Flow. Naive approach works, except importing from another package which can be ignored for now.

// @flow
// $FlowFixMe Flow can't resolve import.
import logger from 'slate-dev-logger'

Flow can be added gradually, file by file. I can help with question, but I am not understanding Slate enough to full type it.

Some people have worked on TypeScript declaration files. I know there's at least one tool online that can convert (though it might have a few issues), or you could use the TypeScript as "inspiration" as it were.

I tried flow with slateJS/ImmutableJS. The unfortunate thing is it is very hard to support extends Records and super-classes. I am trying to switch my plugins from flow to typescript currently.

@zhujinxuan Have you seen ImmutableJS 4? Much better.

@steida I tried, but there is still no way to support extends Record({...})

class Block extends Record({defaultProps}) {
    someUserFunctions() {
    }
}

that

Block.set(string, value) => Block
Block.merge(...) => Block

Hey folks, check the other issues about typings that have been opened in the past. If I was to ever choose to adding typings to Slate I would almost certainly using TypeScript instead of Flow, but at this exact moment I have no plans of incorporating either.

Was this page helpful?
0 / 5 - 0 ratings