0.73.0
The following program type checks with no errors, but should have a missing prop error
// @flow
import React, { type ComponentType } from 'react';
const X: ComponentType<{ foo: string }> = () => null;
export const test = <X />;
when I have a library definition containing the line
import type { Component, ComponentType } from 'react';
... in my flow-typed directory.
Replacing ComponentType with React$ComponentType in the failing example causes the error to be reported correctly.
Removing the import and using React$ComponentType in the libdef causes the failing example to be reported correctly (in my case, along with a few hundred new - seemingly valid - issues in my code base)
Either of
Can you supply a minimal example? I can't reproduce your issue on Try Flow. Are you saying the line in the library definition is silencing this error?
@fishythefish I'm not sure it is possible to reproduce this on try flow. I can only repro this with a .flowconfig and with library file present in the flow-typed folder. To repro you can create three files
// @flow
import React, { type ComponentType } from 'react';
const X: ComponentType<{ foo: string }> = () => null;
const test = <X />;
import type { Component, ComponentType } from 'react';
[libs]
./flow-typed/.*
The error will be silenced as described on flow 0.73.0. Removing the line in the library defintion will correctly result in the error
Error โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ index.js:7:15
Cannot create X element because property foo is missing in props [1] but exists in object type [2].
4โ
[2] 5โ const X: ComponentType<{ foo: string }> = () => null;
6โ
[1] 7โ const test = <X />;
8โ
I'm also getting this issue, and I've set up a small repro here:
Most helpful comment
@fishythefish I'm not sure it is possible to reproduce this on try flow. I can only repro this with a
.flowconfigand with library file present in theflow-typedfolder. To repro you can create three files./index.js
./flow-typed/test.js
.flowconfig
The error will be silenced as described on
flow 0.73.0. Removing the line in the library defintion will correctly result in the error