Skip to content

Add option to disable TS using inline import types in quick fixes #35078

Closed
@mjbvz

Description

@mjbvz

TypeScript Version: 3.8.0-dev.20191112

Search Terms:

  • Implement interface
  • quick fix
  • code action
  • add missing imports

Code
For a small project:

iface.ts

export interface IValue {
    value: number;
}

export interface IFace {
    do(value: IValue): void;
}

index.ts

import { IFace } from "./iface";

export class Foo implements IFace {}
  1. Run implement interface on Foo

Current Behavior:
The generated code is:

import { IFace } from "./iface";

export class Foo implements IFace {
    do(value: import("./iface").IValue): void {
        throw new Error("Method not implemented.");
    }
}

Request
We would like an option to tell TypeScript to not use inline imports and instead always add normal imports at the top of the file.

import { IFace, IValue } from "./iface";

export class Foo implements IFace {
    do(value: IValue): void {
        throw new Error("Method not implemented.");
    }
}

/cc @bpasero Since I know you were passionate about this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Quick FixesEditor-provided fixes, often called code actions.Fix AvailableA PR has been opened for this issueIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions