Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ func (c *Checker) checkAndReportErrorForUsingTypeAsNamespace(errorLocation *ast.
symbol := c.resolveSymbol(c.resolveName(errorLocation, name, ast.SymbolFlagsType&^ast.SymbolFlagsNamespace, nil /*nameNotFoundMessage*/, false /*isUse*/, false /*excludeGlobals*/))
if symbol != nil {
parent := errorLocation.Parent
if ast.IsQualifiedName(parent) {
if c.globalObjectType != nil && ast.IsQualifiedName(parent) {
debug.Assert(parent.AsQualifiedName().Left == errorLocation, "Should only be resolving left side of qualified name as a namespace")
propName := parent.AsQualifiedName().Right.Text()
propType := c.getPropertyOfType(c.getDeclaredTypeOfSymbol(symbol), propName)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error TS2318: Cannot find global type 'Array'.
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'CallableFunction'.
error TS2318: Cannot find global type 'Function'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'NewableFunction'.
error TS2318: Cannot find global type 'Number'.
error TS2318: Cannot find global type 'Object'.
error TS2318: Cannot find global type 'RegExp'.
error TS2318: Cannot find global type 'String'.
importEqualsTypeAsNamespaceNoLib.ts(2,12): error TS2702: 'C' only refers to a type, but is being used as a namespace here.


!!! error TS2318: Cannot find global type 'Array'.
!!! error TS2318: Cannot find global type 'Boolean'.
!!! error TS2318: Cannot find global type 'CallableFunction'.
!!! error TS2318: Cannot find global type 'Function'.
!!! error TS2318: Cannot find global type 'IArguments'.
!!! error TS2318: Cannot find global type 'NewableFunction'.
!!! error TS2318: Cannot find global type 'Number'.
!!! error TS2318: Cannot find global type 'Object'.
!!! error TS2318: Cannot find global type 'RegExp'.
!!! error TS2318: Cannot find global type 'String'.
==== importEqualsTypeAsNamespaceNoLib.ts (1 errors) ====
interface C {}
import x = C.m;
~
!!! error TS2702: 'C' only refers to a type, but is being used as a namespace here.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [tests/cases/compiler/importEqualsTypeAsNamespaceNoLib.ts] ////

//// [importEqualsTypeAsNamespaceNoLib.ts]
interface C {}
import x = C.m;


//// [importEqualsTypeAsNamespaceNoLib.js]
"use strict";
var x = C.m;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [tests/cases/compiler/importEqualsTypeAsNamespaceNoLib.ts] ////

=== importEqualsTypeAsNamespaceNoLib.ts ===
interface C {}
>C : Symbol(C, Decl(importEqualsTypeAsNamespaceNoLib.ts, 0, 0))

import x = C.m;
>x : Symbol(x, Decl(importEqualsTypeAsNamespaceNoLib.ts, 0, 14))

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//// [tests/cases/compiler/importEqualsTypeAsNamespaceNoLib.ts] ////

=== importEqualsTypeAsNamespaceNoLib.ts ===
interface C {}
import x = C.m;
>x : any
>C : any
>m : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @noLib: true

interface C {}
import x = C.m;