untyped-type-import doesn't seem to work
Flow version: 0.97.0
Expected behavior
The untyped-type-import lint should not warn.
Actual behavior
Importing a type from an untyped module makes it any and is not safe!
Did you mean to add // @flow to the top of my-internal-module?
(untyped-type-import)
How to reproduce
.flowconfig
[lints]
untyped-type-import=error
[options]
module.system.node.resolve_dirname=node_modules
Code
test.js
import type { MyType } from 'my-internal-module';
node_modules/my-internal-module
my-internal-module
└── dist
├── index.js.flow
└── modules
└── test.js
index.js.flow
export { MyType } from './modules/test';
test.js
export type MyType = {
// ...
};
Am I doing something wrong? Flow is able to pick up the types with flow type-at-pos.
Would be happy to assist further with debugging and/or submit a PR with some guidance :smile:
+1
I have the same problem.
After I upgrade to the last version of Flow (0.141.0) all my third-party library throw an error
Flow: Importing a type from an untyped module makes it anyand is not safe! Did you mean to add// @flowto the top ofredux-observable?
There is a way to fix it?
my flowconfig:
[ignore]
./test/nightwatch/reports/**
./scripts/**
.*/node_modules/redux-form/lib/index.js.flow
[include]
./packages/common/components/src
./packages/common/function/src
./packages/common/storeComponents/src
./packages/common/types/src
./packages/gipsyApp/src
./packages/initialization/src
./packages/media/src
./packages/setting/src
[libs]
./flow-typed
[lints]
[options]
module.name_mapper='^@domain' ->'<PROJECT_ROOT>/packages/gipsyApp/src/domain/'
esproposal.optional_chaining=enable
esproposal.export_star_as=enable
types_first=false
[strict]
[untyped]
<PROJECT_ROOT>/node_modules/react-select/*
Did anyone find a fix for this?
Can you use flow find-module MyModuleName path/to/file/that/imports/it.js to find out if the modules are being resolved correctly?
Also, if you are actually trying to import a type from an untyped module, it's going to error as that is nonsensical.