Suggestion: deprecate module
keyword in place of namespace
#23684
Labels
module
keyword in place of namespace
#23684
TypeScript Version: 2.7.0-dev.201xxxxx
Search Terms: module, namespace, module vs namespace, module keyword
Suggestion:
The use of the
module
keyword has been replaced withnamespace
, except when actually declaring ES6 modules in a declaration file. However, in my personal experience I still see new developers getting confused about ES6 modules and the TSmodule
keyword, even through it's well documented, because TS silently supports themodule
keyword for backwards compatibility.Why not deprecate the use of the
module
keyword where it "shouldn't" be used anymore? Emit an error or a warning by default, suppressible with a tsconfig flag for backwards compatibility?Code
Expected behavior:
Some kind of warning that
module
here should benamespace
, and that anamespace
is not needed in an ES6 module usingexport
.I realize you could argue a linter is a better place to provide this kind of check, but the idea is to help users during the learning process who will easily fall into the confusion of
module
as a namespace vs ES6 module.Actual behavior:
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: