Merge pull request #13405 from zhengbli/13137

Support import fix for missing namespace
This commit is contained in:
Zhengbo Li 2017-02-02 16:11:08 -08:00 committed by GitHub
commit df643d8d02
3 changed files with 32 additions and 0 deletions

View File

@ -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) => {

View 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;`
]);

View 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;`
]);