, Flow v0.53.0 . , React. , Component . .
(v0.59.0) :
Error: react.js:7
7: export default class IntlDocument extends Document {
^^^^^^^^ identifier `Document`. Expected polymorphic type instead of any member of intersection type
7: export default class IntlDocument extends Document {
^^^^^^^^ intersection
Member 1:
15: declare export default Class<Component<*, *>> & {
^^^^^^^^^^^^^^^^^^^^^^ class type: type application of Component. See lib: types/next-document.js:15
Error:
9: const props = await super.getInitialProps(context)
^^^^^^^^^^^^^^^ property `getInitialProps`. Property not found in
9: const props = await super.getInitialProps(context)
^^^^^ statics of React$Component
Member 2:
v
15: declare export default Class<Component<*, *>> & {
16: getInitialProps: (ctx: Context) => Promise<*>;
17: renderPage(cb: Function): void;
18: };
^ object type. See lib: types/next-document.js:15
Error:
7: export default class IntlDocument extends Document {
^^^^^^^^ identifier `Document`. Expected polymorphic type instead of
v
15: declare export default Class<Component<*, *>> & {
16: getInitialProps: (ctx: Context) => Promise<*>;
17: renderPage(cb: Function): void;
18: };
^ object type. See lib: types/next-document.js:15
Found 1 error
- Document ( "next/document"),
Class<Component<void, *, *>>
{
getInitialProps: (ctx: Context) => Promise<*>;
renderPage(cb: Function): void;
}
, , Document React Component getInitialProps renderPage. getInitialProps renderPage , Document. , Flow ; super.getInitialProps(context) .
super.getInitialProps(context) Document.getInitialProps(context).
- "next/document":
declare export default class Document<Props, State = void> extends React$Component<Props, State> {
static getInitialProps(ctx: Context): Promise<Props>;
static renderPage(cb: Function): void;
}
, . Component :
import type {Component} from 'react';
- . , - , , . Component, , Flow , . , :
types/next-document.js:26
26: declare export default class Document<Props, State = void> extends Component<Props, State> {
^^^^^^^^^ Component. type referenced from value position
2: import type {Component} from 'react';
^^^^^^^^^ type Component
, - . , .
, React ( Flow, . react.js) , , - . . , React$Component ; .