Skip to content

Commit 353cfbd

Browse files
authored
Merge pull request microsoft#21750 from Microsoft/memberCompletionOfUnknownRightSideOfImport
Fix the member completion returned on right side of the import when it does not resolve to any symbol
2 parents bf707ac + 5b1f29c commit 353cfbd

37 files changed

Lines changed: 60 additions & 52 deletions

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24838,8 +24838,10 @@ namespace ts {
2483824838

2483924839
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
2484024840
const symbol = getSymbolAtLocation(node);
24841-
const declaredType = symbol && getDeclaredTypeOfSymbol(symbol);
24842-
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
24841+
if (symbol) {
24842+
const declaredType = getDeclaredTypeOfSymbol(symbol);
24843+
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
24844+
}
2484324845
}
2484424846

2484524847
return unknownType;

tests/baselines/reference/ExportAssignment7.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export class C {
44
}
55

66
export = B;
7-
>B : No type information available!
7+
>B : any
88

tests/baselines/reference/ExportAssignment8.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
=== tests/cases/compiler/ExportAssignment8.ts ===
22
export = B;
3-
>B : No type information available!
3+
>B : any
44

55
export class C {
66
>C : C

tests/baselines/reference/aliasErrors.types

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,31 @@ import beez = foo.bar;
2828

2929
import m = no;
3030
>m : any
31-
>no : No type information available!
31+
>no : any
3232

3333
import m2 = no.mod;
3434
>m2 : any
35-
>no : No type information available!
36-
>mod : No type information available!
35+
>no : any
36+
>mod : any
3737

3838
import n = 5;
3939
>n : any
40-
> : No type information available!
40+
> : any
4141
>5 : 5
4242

4343
import o = "s";
4444
>o : any
45-
> : No type information available!
45+
> : any
4646
>"s" : "s"
4747

4848
import q = null;
4949
>q : any
50-
> : No type information available!
50+
> : any
5151
>null : null
5252

5353
import r = undefined;
5454
>r : any
55-
>undefined : No type information available!
55+
>undefined : any
5656

5757

5858
var p = new provide.Provide();

tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ if (true) {
1111
}
1212

1313
export = foo; // not ok
14-
>foo : No type information available!
14+
>foo : any
1515

tests/baselines/reference/classAbstractManyKeywords.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ default abstract class C {}
1010

1111
import abstract class D {}
1212
>abstract : any
13-
> : No type information available!
13+
> : any
1414
>D : D
1515

tests/baselines/reference/constructorWithIncompleteTypeAnnotation.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare module "fs" {
1919

2020
import fs = module("fs");
2121
>fs : any
22-
>module : No type information available!
22+
>module : any
2323
>("fs") : "fs"
2424
>"fs" : "fs"
2525

tests/baselines/reference/declarationEmitUnknownImport.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== tests/cases/compiler/declarationEmitUnknownImport.ts ===
22
import Foo = SomeNonExistingName
33
>Foo : any
4-
>SomeNonExistingName : No type information available!
4+
>SomeNonExistingName : any
55

66
export {Foo}
77
>Foo : any

tests/baselines/reference/declarationEmitUnknownImport2.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== tests/cases/compiler/declarationEmitUnknownImport2.ts ===
22
import Foo From './Foo'; // Syntax error
33
>Foo : any
4-
>From : No type information available!
4+
>From : any
55
>'./Foo' : "./Foo"
66

77
export default Foo
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== tests/cases/compiler/declareModifierOnImport1.ts ===
22
declare import a = b;
33
>a : any
4-
>b : No type information available!
4+
>b : any
55

0 commit comments

Comments
 (0)