Support shorthand ambient module declarations and wildcard chars in module names #6615
Closed
Description
opened on Jan 25, 2016
follow up on #6614
Related issues: #247 (comment), #5787, #2709, #6371 (comment)
Problems:
- Can not easily specify a loader extension for json or css (e.g. `json!a.json); currently every resources needs to have its own declaration
- Problem with migrating to .ts, with modules that do not have typings, and users just want to get by
Proposal:
-
Allow for short hand module declarations:
declare module "foo";
to be equivalent to:
declare module "foo" { var _temp: any; export = _temp; }
-
Allow module names to have a wildcard character and match that in lookup
declare module "json!*" { let json: any; export default json; } import d from "json!a/b/bar.json"; // lookup: // json!a/b/bar.json // json!*
-
Additional the module "*" would allow for matching all unknown modules in the system, which can be used as a way to suppress all missing module errors
declare module "*"; import d from "some\unknown\module"; // no error, d is any
-
Report no-implicit-any errors for modules declared using the shorthand notion
Open issue: is this reported on declaration or use sites
Activity