mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Don’t create invalid type-only imports during add missing import (#43828)
This commit is contained in:
34
tests/cases/fourslash/importNameCodeFix_typeOnly3.ts
Normal file
34
tests/cases/fourslash/importNameCodeFix_typeOnly3.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @importsNotUsedAsValues: error
|
||||
|
||||
// @Filename: Presenter.ts
|
||||
//// export type DisplayStyle = "normal" | "compact";
|
||||
////
|
||||
//// export default class Presenter {
|
||||
//// present(displayStyle: DisplayStyle): Element {
|
||||
//// return document.createElement("placeholder");
|
||||
//// }
|
||||
//// }
|
||||
|
||||
// @Filename: index.ts
|
||||
//// import type Presenter from "./Presenter";
|
||||
////
|
||||
//// function present(
|
||||
//// presenter: Presenter,
|
||||
//// displayStyle: DisplayStyle,
|
||||
//// ) {}
|
||||
|
||||
goTo.file("index.ts");
|
||||
verify.codeFix({
|
||||
errorCode: ts.Diagnostics.Cannot_find_name_0.code,
|
||||
description: ignoreInterpolations(ts.Diagnostics.Import_0_from_module_1),
|
||||
newFileContent:
|
||||
`import type { DisplayStyle } from "./Presenter";
|
||||
import type Presenter from "./Presenter";
|
||||
|
||||
function present(
|
||||
presenter: Presenter,
|
||||
displayStyle: DisplayStyle,
|
||||
) {}`
|
||||
});
|
||||
Reference in New Issue
Block a user