Skip to content

React: Added Ambient Module Declaration alongside Ambient External Module Declaration - #3959

Closed
bgrieder wants to merge 1 commit into
DefinitelyTyped:masterfrom
bgrieder:master
Closed

bgrieder wants to merge 1 commit into
DefinitelyTyped:masterfrom
bgrieder:master

Conversation

@bgrieder

Copy link
Copy Markdown
Contributor

Make ambient module declarations consistent with other major modules (JQuery, lodash, etc…)
Having an Ambient Module Declaration of React makes React easier to extend

@bgrieder bgrieder changed the title Added Ambient Module Declaration alongside Ambient External Module Declaration React: Added Ambient Module Declaration alongside Ambient External Module Declaration Mar 25, 2015
@bgrieder

Copy link
Copy Markdown
Contributor Author

My apologies, I did not see the discussion before opening this PR

I understand the issue can only be fixed by the Typescript team reworking the syntax of declaration files: allowing external modules declarations to be created by importing internal modules without exposing the internal module name.

Yet, I am not sure I support the decision to not go with the crowd by splitting the definitions in two files in the meantime. This adds to the general confusion between libraries definitions and makes things a lot harder (including for our IDE) just to allow writing import react = require("react") and not "polluting" the global namespace with React. I cannot believe that people having this requirement have it with other, even more popular libraries that do not split files and that they have not adopted a general attitude towards their imports (or just do what seems to be a rather simple refactoring)

In summary, I believe this is a flaw in the definition files that must be fixed by the Typescript team, and not by implementing non recommended temporary workarounds like this one.

Yet, feel free to close and disregard this PR

@bgrieder bgrieder closed this Mar 27, 2015
@bgrieder

Copy link
Copy Markdown
Contributor Author

As a matter of fact IntelliJ 14.1 auto-completion works much better with two separate files... (at least the scenario of the external module definition with CommonJS modules)
Since IJ is our IDE of choice and tooling is of primary importance for the team, I closed this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants