Skip to content

Commit 47a6647

Browse files
committed
add doc
1 parent 457c167 commit 47a6647

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/rules/no-duplicates.md

+21
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,27 @@ import SomeDefaultClass from './mod?minify'
6161
import * from './mod.js?minify'
6262
```
6363

64+
### Inline Type imports
65+
66+
TypeScript 4.5 introduced a new [feature](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5/#type-on-import-names) that allows mixing of named value and type imports. In order to support fixing to an inline type import when duplicate imports are detected, `inlineTypeImport` can be set to true.
67+
68+
Config:
69+
70+
```json
71+
"import/no-duplicates": ["error", {"inlineTypeImport": true}]
72+
```
73+
74+
```js
75+
import { AValue, type AType } from './mama-mia'
76+
import type { BType } from './mama-mia'
77+
```
78+
79+
will fix to
80+
81+
```js
82+
import { AValue, type AType, type BType } from './mama-mia'
83+
```
84+
6485
## When Not To Use It
6586

6687
If the core ESLint version is good enough (i.e. you're _not_ using Flow and you _are_ using [`import/extensions`](./extensions.md)), keep it and don't use this.

0 commit comments

Comments
 (0)