grant / ts2gas

A function that transpiles TypeScript to Google Apps Script.
http://npmjs.com/ts2gas
MIT License
88 stars 11 forks source link

Additional tests #34

Closed PopGoesTheWza closed 5 years ago

PopGoesTheWza commented 5 years ago

Related to #26 Current output:


# testIssue26Export
v--TS--v
export const ICONS = {
  email: `foo.png`,
};
–––
// Compiled using ts2gas 1.6.2 (TypeScript 3.3.3333)
var exports = exports || {};
var module = module || { exports: exports };
exports.ICONS = {
    email: "foo.png"
};
 ^--GS--^
---------------------------------------------------------------------------------
# testIssue26Import
v--TS--v
import { ICONS } from './package';

type _i_ICONS = typeof ICONS;
declare namespace exports {
  const ICONS: _i_ICONS;
}

exports.ICONS.email;

–––
// Compiled using ts2gas 1.6.2 (TypeScript 3.3.3333)
var exports = exports || {};
var module = module || { exports: exports };
//import { ICONS } from './package';
exports.ICONS.email;
 ^--GS--^
---------------------------------------------------------------------------------
# testIssue26Namespaced
v--TS--v
namespace Package {
  export function foo() {}
}

Package.foo();

const nameIWantForMyImports = Package.foo;
nameIWantForMyImports();
–––
// Compiled using ts2gas 1.6.2 (TypeScript 3.3.3333)
var exports = exports || {};
var module = module || { exports: exports };
var Package;
(function (Package) {
    function foo() { }
    Package.foo = foo;
})(Package || (Package = {}));
Package.foo();
var nameIWantForMyImports = Package.foo;
nameIWantForMyImports();
 ^--GS--^```