In my lib module I use imports to files. But tslint always complains that I should not.
import {components} from "./fields/components";
import {components} from "@schemater/search/src/fields/components";
Both imports are marked as not valid in my IDE (PhpStorm).
Which import is correct?
are you using windows? if so, this should be fixed with the next release (see #285, comments in #303).
about wich import is correct, it seems like you are importing from within the same app/lib, so
import {components} from './fields/components';
should be the way. if you import from another library (avoid importing from another app or a lazy loaded library) the import should look like this
import {components} from '@schemater/search';
and the components should be exported at the index.ts of that search library (like mentioned here).
import {components} from '@schemater/search/src/fields/components'; is a deep import, and you should avoid deep imports, and use the mentioned barrel imports instead. only export components/services/... that you want to be public. as one of the benefits your imports look much cleaner...
@piernik, @skydever is correct. Closing this issue. Please open a new one if you have more questions. Thanks!
Most helpful comment
are you using windows? if so, this should be fixed with the next release (see #285, comments in #303).
about wich import is correct, it seems like you are importing from within the same app/lib, so
should be the way. if you import from another library (avoid importing from another app or a lazy loaded library) the import should look like this
and the
componentsshould be exported at theindex.tsof thatsearchlibrary (like mentioned here).import {components} from '@schemater/search/src/fields/components';is a deep import, and you should avoid deep imports, and use the mentioned barrel imports instead. only export components/services/... that you want to be public. as one of the benefits your imports look much cleaner...