question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flow throws errors about blockStyleFn

See original GitHub issue

Flow is throwing two errors related to blockStyleFn.

~/Desktop/Projects/my-project $ flow
Error: node_modules/draft-js/lib/DraftEditor.react.js.flow:245
245:             <DraftEditorContents blockRenderMap={this.props.blockRenderMap} blockRendererFn={this.props.blockRendererFn} blockStyleFn={this.props.blockStyleFn} customStyleMap={{ ...DefaultDraftInlineStyle, ...this.props.customStyleMap }} customStyleFn={this.props.customStyleFn} editorKey={this._editorKey} editorState={this.props.editorState} key={'contents' + this.state.contentsKey} textDirectionality={this.props.textDirectionality} />
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ props of React element `DraftEditorContents`. This type is incompatible with
 44: class DraftEditorContents extends React.Component<Props> {
                                                       ^^^^^ object type. See: node_modules/draft-js/lib/DraftEditorContents.react.js.flow:44
  Property `blockRendererFn` is incompatible:
    245:             <DraftEditorContents blockRenderMap={this.props.blockRenderMap} blockRendererFn={this.props.blockRendererFn} blockStyleFn={this.props.blockStyleFn} customStyleMap={{ ...DefaultDraftInlineStyle, ...this.props.customStyleMap }} customStyleFn={this.props.customStyleFn} editorKey={this._editorKey} editorState={this.props.editorState} key={'contents' + this.state.contentsKey} textDirectionality={this.props.textDirectionality} />
                                                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
     29:   blockRendererFn: Function;
                            ^^^^^^^^ function type. See: node_modules/draft-js/lib/DraftEditorContents.react.js.flow:29

Error: node_modules/draft-js/lib/DraftEditor.react.js.flow:245
245:             <DraftEditorContents blockRenderMap={this.props.blockRenderMap} blockRendererFn={this.props.blockRendererFn} blockStyleFn={this.props.blockStyleFn} customStyleMap={{ ...DefaultDraftInlineStyle, ...this.props.customStyleMap }} customStyleFn={this.props.customStyleFn} editorKey={this._editorKey} editorState={this.props.editorState} key={'contents' + this.state.contentsKey} textDirectionality={this.props.textDirectionality} />
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ props of React element `DraftEditorContents`. This type is incompatible with
 44: class DraftEditorContents extends React.Component<Props> {
                                                       ^^^^^ object type. See: node_modules/draft-js/lib/DraftEditorContents.react.js.flow:44
  Property `blockStyleFn` is incompatible:
    245:             <DraftEditorContents blockRenderMap={this.props.blockRenderMap} blockRendererFn={this.props.blockRendererFn} blockStyleFn={this.props.blockStyleFn} customStyleMap={{ ...DefaultDraftInlineStyle, ...this.props.customStyleMap }} customStyleFn={this.props.customStyleFn} editorKey={this._editorKey} editorState={this.props.editorState} key={'contents' + this.state.contentsKey} textDirectionality={this.props.textDirectionality} />
                                                                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
     30:   blockStyleFn: (block: ContentBlock) => string;
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/draft-js/lib/DraftEditorContents.react.js.flow:30

I’m encountering these errors on a fresh project, with draft-js at 0.10.4 and flow-bin at 0.58.0.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
xixixaocommented, Dec 25, 2017

Better fix:

Remove the question marks (optional types) from node_modules/draft-js/lib/DraftEditorProps.js.flow line 62, 65.

It has been fixed on master but not released apparently.

0reactions
niveditccommented, Sep 9, 2018

This is fixed now - no flow errors at the root of the project. Please reopen if I’m missing something here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Suppressions - JavaScript. Flow
Flow reports many different kinds of errors for many common programming mistakes, but not every JavaScript pattern can be understood by Flow.
Read more >
Solved: On Error Block not triggering and catching error
I've been trying to implement "On Block Error" blocks that will catch any errors thrown by the actions they are encapsulating and handle...
Read more >
Flow throws an Error when using the Filter ...
When using the 'Look Up Records' Action in a Flow or Subflow, using the Filter with any field as 'ENDSWITHAPPLICATION' causes the Flow...
Read more >
Record Triggered flow builder - Salesforce Developers
But using Record Trigger Flow, One Custom Field, Validation Rule we can ... Can you please tell me how to throw error in...
Read more >
Salesforce Error: Failed to trigger a flow
Flow error messages: An unhandled fault has occurred in this flow An ... you have set in Salesforce related to the object that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found