From 3c0634c0ea02312ed443c119b41b3e62e53cec06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0ulovsk=C3=BD?= Date: Thu, 30 Jun 2022 21:23:33 +0200 Subject: [PATCH] Add mention of `import type` to import section --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index a020998..f90e13f 100644 --- a/README.md +++ b/README.md @@ -2683,6 +2683,7 @@ With clean and easy to read import statements you can quickly see the dependenci - Unused imports should be removed. - Named imports must be alphabetized (i.e. `import {A, B, C} from 'foo';`) - Import sources must be alphabetized within groups, i.e.: `import * as foo from 'a'; import * as bar from 'b';` +- Prefer using `import type` instead of `import` when importing only types from a file to avoid dependency cycles, as these imports are erased at runtime - Groups of imports are delineated by blank lines. - Groups must respect following order: - Polyfills (i.e. `import 'reflect-metadata';`) @@ -2697,6 +2698,7 @@ With clean and easy to read import statements you can quickly see the dependenci ```ts import { TypeDefinition } from '../types/typeDefinition'; import { AttributeTypes } from '../model/attribute'; +import { Customer, Credentials } from '../model/types'; import { ApiCredentials, Adapters } from './common/api/authorization'; import fs from 'fs'; import { ConfigPlugin } from './plugins/config/configPlugin'; @@ -2714,6 +2716,7 @@ import { BindingScopeEnum, Container } from 'inversify'; import { AttributeTypes } from '../model/attribute'; import { TypeDefinition } from '../types/typeDefinition'; +import type { Customer, Credentials } from '../model/types'; import { ApiCredentials, Adapters } from './common/api/authorization'; import { ConfigPlugin } from './plugins/config/configPlugin';