Draft-js: Flow errors with flow 0.39.0 and draft-js 0.10.0

Created on 17 Feb 2017  路  4Comments  路  Source: facebook/draft-js

ERROR in node_modules/draft-js/lib/expandRangeToStartOfLine.js.flow:34
 34:   document.body.appendChild(div);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `appendChild`. Method cannot be called on possibly null value
 34:   document.body.appendChild(div);
       ^^^^^^^^^^^^^ null

node_modules/draft-js/lib/expandRangeToStartOfLine.js.flow:36
 36:   document.body.removeChild(div);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `removeChild`. Method cannot be called on possibly null value
 36:   document.body.removeChild(div);
       ^^^^^^^^^^^^^ null

node_modules/draft-js/lib/findRangesImmutable.js.flow:32
 32:     /* $FlowFixMe(>=0.28.0): `value` could be undefined! */
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression

node_modules/draft-js/lib/findRangesImmutable.js.flow:34
 34:       /* $FlowFixMe(>=0.28.0): `value` could be undefined! */
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression

node_modules/draft-js/lib/getSafeBodyFromHTML.js.flow:29
 29:     doc.documentElement.innerHTML = html;
                             ^^^^^^^^^ property `innerHTML`. Property cannot be assigned on possibly null value
 29:     doc.documentElement.innerHTML = html;
         ^^^^^^^^^^^^^^^^^^^ null

../../../../steckel/react-storybook/node_modules/fbjs/lib/partitionObjectByKey.js.flow:20
 20:   return partitionObject(source, (_, key) => whitelist.has(key));
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tuple type. This type is incompatible with the expected return type of
 19: function partitionObjectByKey(source: Object, whitelist: Set<string>): Array<Object> {
                                                                            ^^^^^^^^^^^^^ array type

Most helpful comment

I think we're good here.

All 4 comments

I seem to have similar flow issues in flow 0.40.0 as well. Is there anyone with any expertise here who could point me into the right direction? I'm happy to volunteer time and effort into resolving and contributing flow updates given some guidance.

I've updated https://github.com/etrepum/repro-draft-js-flow-issue to demonstrate this failure (with draft-js 0.10.0 + flow-bin 0.41.0), you can see the failed build at https://travis-ci.org/etrepum/repro-draft-js-flow-issue

I think we're good here.

Was this page helpful?
0 / 5 - 0 ratings