TypeScript/tests/cases/compiler/APISample_transform.ts

27 lines
807 B
TypeScript
Raw Normal View History

2015-01-29 20:23:02 +01:00
// @module: commonjs
// @skipLibCheck: true
2018-06-12 21:52:06 +02:00
// @includebuiltfile: typescriptServices.d.ts
// @noImplicitAny:true
// @strictNullChecks:true
2015-01-29 20:23:02 +01:00
2018-06-12 21:52:06 +02:00
// @filename: node_modules/typescript/index.d.ts
declare module "typescript" {
export = ts;
}
// @filename: APISample_transform.ts
2015-01-29 20:23:02 +01:00
/*
2018-06-12 21:52:06 +02:00
* Note: This test is a public API sample. The sample sources can be found
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
2015-01-29 20:23:02 +01:00
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
declare var console: any;
import * as ts from "typescript";
2015-01-29 20:23:02 +01:00
const source = "let x: string = 'string'";
2015-01-29 20:23:02 +01:00
let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
2015-01-29 20:23:02 +01:00
console.log(JSON.stringify(result));