question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

closure fails on tsickle output [on a simple test case]

See original GitHub issue

latest compiler[^20170124.0.0] & tsickle[^2.1.6] (please help @mprobst @evmar @petebacondarwin @alexeagle @vikerman )

error build/testScript.js:2: ERROR - Required namespace “build_testDep” never defined. var testDep_1 = goog.require(‘build_testDep’);

command tsickle: “./node_modules/.bin/tsickle” --externs=build/externs.js

// tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "noImplicitAny": false,
    "sourceMap": false,
    "outDir": "build",
    "module": "commonjs",
    "noEmitHelpers": false
  },
  "include": [
    "src/test*.ts"
  ],
  "exclude": [
  ]
}

command compiler: java -jar ./node_modules/google-closure-compiler/compiler.jar --compilation_level ADVANCED --js build/*.js --js_output_file dist/p.js --output_wrapper "!function(){%output%}.call({});

// testScript.ts

import {Dep} from "./testDep";

class Test {
    value: Dep;
    constructor(val: Dep) {
        this.value = val;
        alert('still testing');
    }
}

var t: Test = new Test(new Dep(1));
alert('i am compiled!');

(after tsickle)

goog.module('build.testScript'); exports = {}; var module = {id: 'build/testScript.js'};
var testDep_1 = goog.require('build_testDep');
var Dep = testDep_1.Dep; /* local alias for Closure JSDoc */
var Test = (function () {
    /**
     * @param {!Dep} val
     */
    function Test(val) {
        this.value = val;
        alert('still testing');
    }
    return Test;
}());
function Test_tsickle_Closure_declarations() {
    /** @type {!Dep} */
    Test.prototype.value;
}
var /** @type {!Test} */ t = new Test(new testDep_1.Dep(1));
alert('i am compiled!');

// testDep.ts

class Dep {
    value: Number;
    constructor(val: Number) {
       this.value = val;
    }
}

export {Dep};

(after tsickle)

goog.module('build.testDep'); exports = {}; var module = {id: 'build/testDep.js'};
var Dep = (function () {
    /**
     * @param {!Number} val
     */
    function Dep(val) {
        this.value = val;
    }
    return Dep;
}());
exports.Dep = Dep;
function Dep_tsickle_Closure_declarations() {
    /** @type {!Number} */
    Dep.prototype.value;
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
evmarcommented, Feb 22, 2017

Great guess! You are probably the first person to try this on Windows. 😃

2reactions
orenmizrcommented, Feb 20, 2017

i realize this is work in progress (and very appreciative of it). however, if this utility isn’t a standalone and only tested for angular setup environments - please state it in the docs. i was scratching my head for countless hours. I might not be the only one.

do you need me to change to headline to be descriptive of the bug ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

tsickle breaks module names when outDir specified #481
Running tsickle produces almost valid output, except index.js ... goog.require('tsout_classB'); is causing the closure compiler to fail.
Read more >
Closure Compiler With Webpack + Typescript
The Closure Compiler lets you choose from three levels of compilation, ranging from simple removal of whitespace and comments to aggressive code ...
Read more >
tsickle
Tsickle is designed to do whatever is necessary to make the code acceptable by Closure compiler. We view its output as a necessary...
Read more >
How to know testcases where code fails?
In stress testing, the idea is to generate random test cases and check the output of the brute force solution and the optimal...
Read more >
Test Case Status - TechDocs - Broadcom Inc.
Usually a failed test case is related to at least one open defect. In fact, the workflow engine default rule set for defects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found