mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-13 14:29:00 -06:00
Merge pull request #13405 from zhengbli/13137
Support import fix for missing namespace
This commit is contained in:
commit
df643d8d02
@ -115,6 +115,7 @@ namespace ts.codefix {
|
||||
registerCodeFix({
|
||||
errorCodes: [
|
||||
Diagnostics.Cannot_find_name_0.code,
|
||||
Diagnostics.Cannot_find_namespace_0.code,
|
||||
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
||||
],
|
||||
getCodeActions: (context: CodeFixContext) => {
|
||||
|
||||
15
tests/cases/fourslash/importNameCodeFixNewImportFile3.ts
Normal file
15
tests/cases/fourslash/importNameCodeFixNewImportFile3.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// [|let t: XXX/*0*/.I;|]
|
||||
|
||||
// @Filename: ./module.ts
|
||||
//// export module XXX {
|
||||
//// export interface I {
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.importFixAtPosition([
|
||||
`import { XXX } from "./module";
|
||||
|
||||
let t: XXX.I;`
|
||||
]);
|
||||
16
tests/cases/fourslash/importNameCodeFixNewImportFile4.ts
Normal file
16
tests/cases/fourslash/importNameCodeFixNewImportFile4.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// [|let t: A/*0*/.B.I;|]
|
||||
|
||||
// @Filename: ./module.ts
|
||||
//// export namespace A {
|
||||
//// export namespace B {
|
||||
//// export interface I { }
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.importFixAtPosition([
|
||||
`import { A } from "./module";
|
||||
|
||||
let t: A.B.I;`
|
||||
]);
|
||||
Loading…
x
Reference in New Issue
Block a user