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

Create goog.module from module d.ts files #950

Closed
evmar opened this issue Nov 30, 2018 · 2 comments
Closed

Create goog.module from module d.ts files #950

evmar opened this issue Nov 30, 2018 · 2 comments

Comments

@evmar
Copy link
Contributor

evmar commented Nov 30, 2018

When given a module d.ts file, e.g.

export type A = ...;
declare global {
  type B = ...;
}

tsickle needs to emit two files:

//////// file 1: externs
/** @externs */
/** @typedef or whatever */
const A;

/** @typedef or whatever */
const mangled$name$B;

//////// file 2: module
goog.module('module.name');
exports.B = mangled$name$B;

tsickle currently correctly emits the first file, but leaves out the second module file. The second file is needed so that users that import this d.ts can refer to module.name.B in type annotations.

If there are any values inside the module, tsickle should just drop them for now, because there's no way to alias a value in a module.

questions

Do we need to create an alias for each export? Or will something like exports = mangled$name; be sufficient? Will likely need an experiment.

@mprobst
Copy link
Contributor

mprobst commented Nov 30, 2018 via email

@evmar
Copy link
Contributor Author

evmar commented Jul 8, 2019

This is basically a dup of the longer #1041 .

@evmar evmar closed this as completed Jul 8, 2019
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

No branches or pull requests

2 participants