Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
This repository was archived by the owner on May 22, 2025. It is now read-only.

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

Closed
@orenmizr

Description

@orenmizr

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions