target ES2015 combined with external jquery reference throws JSC_REDECLARED_VARIABLE_ERROR
BrianLeishman opened this issue · 1 comments
BrianLeishman commented
tscc.spec.json
{
"modules": {
"app": ".tscc_temp/app.ts"
},
"external": {
"jquery": "$"
},
"prefix": "../../public/v2/js/",
"compilerFlags": {
"rewrite_polyfills": true,
"language_out": "ES5_STRICT",
"compilation_level": "ADVANCED_OPTIMIZATIONS",
"use_types_for_optimization": true,
"output_wrapper": "(function(){%output%})()"
}
}
tsconfig.json
{
"compilerOptions": {
"alwaysStrict": true,
"strict": true,
"sourceMap": true,
"noImplicitAny": true,
"target": "ES2015",
},
"include": [
"ts/*.ts",
],
}
And then running returns the following output
TSCC: tsickle converts TypeScript modules to Closure modules via CommonJS internally."module" flag is overridden to "commonjs".
TSCC: tsickle uses a custom tslib optimized for closure compiler. importHelpers flag is set.
TS: .tscc_temp/app.ts(111,11): warning TS0: unhandled type flags: Intersection
TS: .tscc_temp/app.ts(132,7): warning TS0: unhandled type flags: Intersection
ClosureCompiler: /domains/aan/v2/.tscc_temp/c8bf3662b5091e49be4d590eb031e02fde0538e36e1889bb0eda455e0527ce38/externs_generated.js:26284:6: ERROR - [JSC_REDECLARED_VARIABLE_ERROR] Illegal redeclared variable: $
26284| const $ = {};
^^^^^^
1 error(s), 0 warning(s)
✖ Closure compiler error
TSCC: Closure compiler has exited with code 1
TSCC: The compilation has terminated with an error.
Got here in an attempt to compile to ES5 with closure compiler, but while using async functions, and Closure Compiler can handle the promise polyfill
BrianLeishman commented
Wrong repo, this is a TSCC issue, not a tsickle issue