Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow module keyword in new code where namespace could be used? #6808

Closed
Arnavion opened this issue Feb 2, 2016 · 4 comments
Closed

Disallow module keyword in new code where namespace could be used? #6808

Arnavion opened this issue Feb 2, 2016 · 4 comments
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript

Comments

@Arnavion
Copy link
Contributor

Arnavion commented Feb 2, 2016

We occasionally get people who ask questions about modules and exports, and after some back-and-forth and sharing of code we realize they're mixing features of namespaces and (external) modules based on what they found from the handbook and other places on the internet.

Do you think it makes sense to report an error when using module where namespace could be used instead, with a new --allowInternalModuleKeyword compiler option for existing codebases? This will help steer new users in the right direction while still having minimal impact on existing codebases.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 2, 2016

We have shied away from syntactic breaking changes, specially here when the value is mainly cleanliness. We use tslint rule to flag these internally.

We should reconsider though, and follow some depreciation process, similar to the 0.8/0.9 days with warning first with a flag to suppress the warning, and then erroring with a flag to allow the old syntax to finally removing it all together.

@mhegazy mhegazy added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Feb 2, 2016
@RyanCavanaugh RyanCavanaugh added Out of Scope This idea sits outside of the TypeScript language design constraints and removed In Discussion Not yet reached consensus labels Mar 15, 2016
@RyanCavanaugh
Copy link
Member

Simply too much module code out there with nothing else wrong to make this a plausible migration path. TSLint is the tool of choice as usual for enforcing these sorts of things.

@Arnavion
Copy link
Contributor Author

tslint is far from what new devs reach for, but I understand. Let's hope this is fixed in the new handbook atleast.

@RyanCavanaugh
Copy link
Member

Yep, if you see module in our official docs please log a bug.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants