Microsoft/TypeScript

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

オープン

#10,464 opened on 2016/08/21

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
BugDomain: Error MessagesEffort: ModerateHelp Wanted

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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"').

コントリビューターガイド