-
Notifications
You must be signed in to change notification settings - Fork 109
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
Question: closure compiler externs problem. #661
Comments
martin19
changed the title
closure compiler externs problem.
Question: closure compiler externs problem.
Nov 27, 2017
In TypeScript external modules always generate an import, e.g. a
"require()" call. In tsickle, we translate these imports into
"goog.require" calls. Closure Compiler then tries to satisfy the
goog.require(), but cannot find any code for it.
The question is where you get "Foo.EPSILON" and the other symbols from at
runtime. A common case is a library you load that's external to your
Closure Compiler bundle, with the library installing global symbols on
"window". For that case, you can write a JavaScript shim file (not TS!):
```
goog.module('externalmodule');
exports = window.TheGlobalSymbol;
```
Closure Compiler will compile this into your bundle, and then at runtime
resolve your module import using `window.TheGlobalSymbol` (or whatever).
|
Thank you for the help. After some days of tsickling...
...I've found out (closure output):
And I'm left with: 0 error(s), 3057 warning(s), 71.9% typed I'm a bit disillusioned. Even if the readme has warned about that. |
Gonna fold this into the general "externs are a mess" #1041 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to get rolling with generating externs for google closure compiler with tsickle.
Here is my setup.
main.ts
foo.d.ts
The following files are generated.
main.js
extern.js
closure compiler outputs:
What is the problem here?
The text was updated successfully, but these errors were encountered: