mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix the member completion returned on right side of the import when it does not resolve to any symbol
Fixes #20794
This commit is contained in:
@@ -24838,8 +24838,10 @@ namespace ts {
|
||||
|
||||
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
|
||||
const symbol = getSymbolAtLocation(node);
|
||||
const declaredType = symbol && getDeclaredTypeOfSymbol(symbol);
|
||||
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
|
||||
if (symbol) {
|
||||
const declaredType = getDeclaredTypeOfSymbol(symbol);
|
||||
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
return unknownType;
|
||||
|
||||
@@ -4,5 +4,5 @@ export class C {
|
||||
}
|
||||
|
||||
export = B;
|
||||
>B : No type information available!
|
||||
>B : any
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/compiler/ExportAssignment8.ts ===
|
||||
export = B;
|
||||
>B : No type information available!
|
||||
>B : any
|
||||
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
@@ -28,31 +28,31 @@ import beez = foo.bar;
|
||||
|
||||
import m = no;
|
||||
>m : any
|
||||
>no : No type information available!
|
||||
>no : any
|
||||
|
||||
import m2 = no.mod;
|
||||
>m2 : any
|
||||
>no : No type information available!
|
||||
>mod : No type information available!
|
||||
>no : any
|
||||
>mod : any
|
||||
|
||||
import n = 5;
|
||||
>n : any
|
||||
> : No type information available!
|
||||
> : any
|
||||
>5 : 5
|
||||
|
||||
import o = "s";
|
||||
>o : any
|
||||
> : No type information available!
|
||||
> : any
|
||||
>"s" : "s"
|
||||
|
||||
import q = null;
|
||||
>q : any
|
||||
> : No type information available!
|
||||
> : any
|
||||
>null : null
|
||||
|
||||
import r = undefined;
|
||||
>r : any
|
||||
>undefined : No type information available!
|
||||
>undefined : any
|
||||
|
||||
|
||||
var p = new provide.Provide();
|
||||
|
||||
@@ -11,5 +11,5 @@ if (true) {
|
||||
}
|
||||
|
||||
export = foo; // not ok
|
||||
>foo : No type information available!
|
||||
>foo : any
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@ default abstract class C {}
|
||||
|
||||
import abstract class D {}
|
||||
>abstract : any
|
||||
> : No type information available!
|
||||
> : any
|
||||
>D : D
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ declare module "fs" {
|
||||
|
||||
import fs = module("fs");
|
||||
>fs : any
|
||||
>module : No type information available!
|
||||
>module : any
|
||||
>("fs") : "fs"
|
||||
>"fs" : "fs"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/declarationEmitUnknownImport.ts ===
|
||||
import Foo = SomeNonExistingName
|
||||
>Foo : any
|
||||
>SomeNonExistingName : No type information available!
|
||||
>SomeNonExistingName : any
|
||||
|
||||
export {Foo}
|
||||
>Foo : any
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/declarationEmitUnknownImport2.ts ===
|
||||
import Foo From './Foo'; // Syntax error
|
||||
>Foo : any
|
||||
>From : No type information available!
|
||||
>From : any
|
||||
>'./Foo' : "./Foo"
|
||||
|
||||
export default Foo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/declareModifierOnImport1.ts ===
|
||||
declare import a = b;
|
||||
>a : any
|
||||
>b : No type information available!
|
||||
>b : any
|
||||
|
||||
|
||||
@@ -122,6 +122,6 @@ namespace Test5 {
|
||||
import lol = Test5.Foo.
|
||||
>lol : any
|
||||
>Test5 : typeof Test5
|
||||
>Foo : No type information available!
|
||||
> : No type information available!
|
||||
>Foo : any
|
||||
> : any
|
||||
|
||||
|
||||
@@ -17,5 +17,5 @@ module m0 {
|
||||
>c : any
|
||||
>a : any
|
||||
>b : any
|
||||
>ma : No type information available!
|
||||
>ma : any
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ module x {
|
||||
export public import a = x.c;
|
||||
>a : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
export private import b = x.c;
|
||||
>b : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
export static import c = x.c;
|
||||
>c : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
var b: a;
|
||||
>b : any
|
||||
|
||||
@@ -9,7 +9,7 @@ module x {
|
||||
declare export import a = x.c;
|
||||
>a : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
var b: a;
|
||||
>b : any
|
||||
|
||||
@@ -9,7 +9,7 @@ module x {
|
||||
export import a = x.c;
|
||||
>a : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
var b: a;
|
||||
>b : any
|
||||
|
||||
@@ -9,7 +9,7 @@ module x {
|
||||
export import a = x.c;
|
||||
>a : any
|
||||
>x : any
|
||||
>c : No type information available!
|
||||
>c : any
|
||||
|
||||
export = x;
|
||||
>x : any
|
||||
|
||||
@@ -7,7 +7,7 @@ var V = 12;
|
||||
|
||||
import v = V;
|
||||
>v : any
|
||||
>V : No type information available!
|
||||
>V : any
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
@@ -18,7 +18,7 @@ class C {
|
||||
|
||||
import c = C;
|
||||
>c : any
|
||||
>C : No type information available!
|
||||
>C : any
|
||||
|
||||
enum E {
|
||||
>E : E
|
||||
@@ -41,5 +41,5 @@ interface I {
|
||||
|
||||
import i = I;
|
||||
>i : any
|
||||
>I : No type information available!
|
||||
>I : any
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export default class a {
|
||||
>a : a
|
||||
}
|
||||
export default var a = 10;
|
||||
> : No type information available!
|
||||
> : any
|
||||
>a : number
|
||||
>10 : 10
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
export = b;
|
||||
>b : No type information available!
|
||||
>b : any
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
import a = b;
|
||||
>a : any
|
||||
>b : No type information available!
|
||||
>b : any
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ let i: I; // Should succeed thanks to type parameter default
|
||||
/** @typedef {string} N.Str */
|
||||
import M = N; // Error: @typedef does not create namespaces in TypeScript code.
|
||||
>M : any
|
||||
>N : No type information available!
|
||||
>N : any
|
||||
|
||||
// Not legal JSDoc, but that shouldn't matter in TypeScript.
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ module A.B.C {
|
||||
import XYZ = X.Y.Z;
|
||||
>XYZ : any
|
||||
>X : typeof X
|
||||
>Y : No type information available!
|
||||
>Z : No type information available!
|
||||
>Y : any
|
||||
>Z : any
|
||||
|
||||
export function ping(x: number) {
|
||||
>ping : (x: number) => void
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser519458.ts ===
|
||||
import rect = module("rect"); var bar = new rect.Rect();
|
||||
>rect : any
|
||||
>module : No type information available!
|
||||
>module : any
|
||||
>("rect") : "rect"
|
||||
>"rect" : "rect"
|
||||
>bar : any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment1.ts ===
|
||||
export = foo
|
||||
>foo : No type information available!
|
||||
>foo : any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment2.ts ===
|
||||
export = foo;
|
||||
>foo : No type information available!
|
||||
>foo : any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment3.ts ===
|
||||
export =
|
||||
> : No type information available!
|
||||
> : any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment4.ts ===
|
||||
export = ;
|
||||
> : No type information available!
|
||||
> : any
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ module M {
|
||||
>M : typeof M
|
||||
|
||||
export = A;
|
||||
>A : No type information available!
|
||||
>A : any
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment6.ts ===
|
||||
declare module "M" {
|
||||
export = A;
|
||||
>A : No type information available!
|
||||
>A : any
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ export class C {
|
||||
}
|
||||
|
||||
export = B;
|
||||
>B : No type information available!
|
||||
>B : any
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ExportAssignments/parserExportAssignment8.ts ===
|
||||
export = B;
|
||||
>B : No type information available!
|
||||
>B : any
|
||||
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
@@ -3,12 +3,12 @@ namespace Foo {
|
||||
>Foo : typeof Foo
|
||||
|
||||
export default foo;
|
||||
>foo : No type information available!
|
||||
>foo : any
|
||||
}
|
||||
|
||||
module Bar {
|
||||
>Bar : typeof Bar
|
||||
|
||||
export default bar;
|
||||
>bar : No type information available!
|
||||
>bar : any
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/parserImportDeclaration1.ts ===
|
||||
import TypeScript = TypeScriptServices.TypeScript;
|
||||
>TypeScript : any
|
||||
>TypeScriptServices : No type information available!
|
||||
>TypeScript : No type information available!
|
||||
>TypeScriptServices : any
|
||||
>TypeScript : any
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Fixes #15094
|
||||
export import Component = CompletelyMissing;
|
||||
>Component : any
|
||||
>CompletelyMissing : No type information available!
|
||||
>CompletelyMissing : any
|
||||
|
||||
=== tests/cases/compiler/first.d.ts ===
|
||||
import * as Second from './second';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/scanner/ecmascript5/scannerImportDeclaration1.ts ===
|
||||
import TypeScript = TypeScriptServices.TypeScript;
|
||||
>TypeScript : any
|
||||
>TypeScriptServices : No type information available!
|
||||
>TypeScript : No type information available!
|
||||
>TypeScriptServices : any
|
||||
>TypeScript : any
|
||||
|
||||
|
||||
@@ -66,5 +66,5 @@ module M {
|
||||
|
||||
import d = asdf;
|
||||
>d : any
|
||||
>asdf : No type information available!
|
||||
>asdf : any
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////import x = M./**/
|
||||
|
||||
goTo.marker("");
|
||||
verify.completionListIsEmpty();
|
||||
Reference in New Issue
Block a user