Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Exporting to d3 global from separate modules (duplicate identifier error) #41

Closed
tomwanzek opened this issue Jul 11, 2016 · 7 comments
Closed

Comments

@tomwanzek
Copy link
Owner

Using export as namespace d3; to export each separate D3 module to a merged d3 global creates a compiler error: Duplicate Identifier 'd3'

When the individual D3 modules are used in a vanilla context (i.e. separately included scripts), they all expose their methods/properties under a d3 global. See release notes for D3 version 4 regarding different use scenarios supported.

In the specific case of D3, this behavior should ideally be supportable from a definitions perspective. There are no conflicts between identifiers exported from the individual modules (definitions).

Closed TypeScript 2.0 issue 'Built-In Support for UMD module definitions' contains the following statement in the Solution summary section:

These declarations may engage in module merging, though this should probably be discouraged somehow.

@tomwanzek tomwanzek added this to the Core Modules (Enhanced) milestone Jul 11, 2016
@tomwanzek tomwanzek self-assigned this Jul 11, 2016
@tomwanzek
Copy link
Owner Author

Posted related question to aforementioned (closed) Typescript 2.0 issue.

@tomwanzek
Copy link
Owner Author

Opened as new issue on typescript.

@tomwanzek
Copy link
Owner Author

No action from the TS team on the opened TypeScript issue to date. Followed up earlier.

The matter was also cross-referenced as a known open issue with an ask for comment/response in the DefinitelyTyped issue tracking the migration of this repo. See this comment there.

Next step: investigate who else w/ TypeScript can comment on the issue and suggest a preferably simple solution.

@tomwanzek
Copy link
Owner Author

Reiterated the need for guidance/response to TypeScript issue 9681 by cross-reference in the tracking issue 9936 for D3 Definitions and affected PRs on DefinitelyTyped.

@tomwanzek
Copy link
Owner Author

Now under active discussion under Typescript Issue 9681

@tomwanzek
Copy link
Owner Author

Still open on TypeScript. Has been flagged as Question and assigned owner.

tomwanzek added a commit that referenced this issue Aug 24, 2016
Definitions for all D3 standard bundle modules are now functionally complete, subject to the TypeScript issue regarding the `d3` global for individual modules tracked as issue #41.

Included are also completed optional module definitions for:
* d3-selection-multi
* d3-hsv

Thanks to @gustavderdrache @Ledragon @arrayjam for their contributions.
@tomwanzek
Copy link
Owner Author

As the module-level migration to the DefinitelyTyped/types-2.0 branch is complete, this issue will be closed. The issue is already listed in the DefinitelyTyped Definition Request Issue 9936 for the new definitions and cross-referenced to the issue opened on TypeScript.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant