Skip to content

[consistent-type-specifier-style] should support mixed style #2676

Closed
@latin-1

Description

@latin-1

With "importsNotUsedAsValues": "error" in tsconfig.json, import { type T } is no longer a valid TypeScript code.

I hope there could be a code fix:

import { type A, type B } from "./mod";
// ↓
import type { A, B } from "./mod";

while still preserve this as-is:

import { A, type B } from "./mod";

Valid Code

import { A, B } from "./mod"; // for normal imports
import { type A, B } from "./mod"; // for mixed imports
import type { T } from "./mod"; // for type-only imports

TypeScript Compiler Behavior

"importsNotUsedAsValues": "remove"

import type { T } from "./mod";
// ↓
export {};
import { type T } from "./mod";
// ↓
export {};

"importsNotUsedAsValues": "error"

import type { T } from "./mod";
// ↓
export {};
// @ts-expect-error ts(1371)
import { type T } from "./mod";
// ↓
import "./mod";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions