Files
DefinitelyTyped/google-closure-compiler/google-closure-compiler-tests.ts
Evan Martin ea5859b23c fix the type of google-closure-compiler CompileOptions (#9228)
The type shown in the JSDoc is wrong.  This patch copies the sample
code from the README into the test to verify that the type is right.
2016-05-06 07:44:19 -06:00

38 lines
1.1 KiB
TypeScript

/// <reference path="google-closure-compiler.d.ts" />
import * as GoogleClosureCompiler from 'google-closure-compiler';
// See
// https://github.com/chadkillingsworth/closure-compiler-npm#plugin-authors-and-native-node-usage
// for the API example. This code tries to do the exact same thing.
let ClosureCompiler = GoogleClosureCompiler.compiler;
console.log(ClosureCompiler.COMPILER_PATH)
console.log(ClosureCompiler.CONTRIB_PATH)
let options: GoogleClosureCompiler.CompileOptions = {
js: 'file-one.js',
compilation_level: 'ADVANCED',
};
let closureCompiler = new ClosureCompiler(options);
let compilerProcess = closureCompiler.run((exitCode, stdout, stderr) => {
// ...
});
let jsonStream: GoogleClosureCompiler.JSONStreamFile[] = [
{
path: 'foo.js',
src: 'var x = "hello, world";',
},
];
// Test the various options formats -- see
// https://github.com/ChadKillingsworth/closure-compiler-npm#specifying-options
let optionsFormats: GoogleClosureCompiler.CompileOptions = {
js: ['/file-one.js', '/file-two.js'],
compilation_level: 'ADVANCED',
js_output_file: 'out.js',
debug: true
};