Microsoft/TypeScript

Give a better error message when an import isn't found but a namespace of the same name exists

Open

#10,464 建立於 2016年8月21日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: Error MessagesEffort: ModerateHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

See #10463.

foo.d.ts

declare module foo {
    // ...
}

bar.ts

import foo = require("foo");

"foo" won't be found, but if the compiler can resolve an identifier named foo to a namespace that uses the declare module syntax, we should probably give an error like

Cannot find module 'foo'.
  A legacy-style namespace with the same name was found.
    Try changing the declaration to use quotes (e.g. 'declare module "foo"').

貢獻者指南