Microsoft/TypeScript

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

Open

#10.464 aperta il 21 ago 2016

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)TypeScript (6726 fork)batch import
BugDomain: Error MessagesEffort: ModerateHelp Wanted

Metriche repository

Star
 (48.455 star)
Metriche merge PR
 (Merge medio 6g 17h) (9 PR mergiate in 30 g)

Descrizione

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

Guida contributor