TypeScript/tests/cases/compiler/importExportInternalComments.ts
Wesley Wigham 1c93744a9c
Much better comment preservation (#22141)
* Retain comments on (and produce sourcemaps on) the equals token in initializers

* Improved comments/sourcemaps for await, yield, while, and for

* Retain comments on block curly-braces

* Emit comments for if statements

* Improved switch case comment emit

* Improve comment and sourcemap emit for try/catch, throw, and continue statements

* Improve sourcemap emit and comments for with statements

* More accurate sourcemaps+comments emit for new, typeof, void, and delete

* Improve comment emit for element access expressions

* Preserve more comments on imports and exports

* Make function a bit more defensive like other usages of emitTrailingCommentsOfPosition

* Support preserving comments within empty lists

* Handle leading comments of tokens, conditionally indent leading comments

* Stop heuristically sourcemapping tokens

When the transform was trivial it worked, but was unneeded, but when it was complex, it was brittle - best leave source mapping up to the transformers

* Fix unneeded +1

* Tighten up element access comments

* Handle comments on parenthesized expression tokens

* Fix nit
2018-03-02 17:23:59 -08:00

15 lines
552 B
TypeScript

// @target: esnext
// @filename: include.d.ts
declare module "foo";
// @filename: default.ts
/*1*/ export /*2*/ default /*3*/ Array /*4*/;
// @filename: index.ts
/*1*/ import /*2*/ D /*3*/, /*4*/ { /*5*/ A /*6*/, /*7*/ B /*8*/ as /*9*/ C /*10*/ } /*11*/ from /*12*/ "foo";
/*1*/ import /*2*/ * /*3*/ as /*4*/ foo /*5*/ from /*6*/ "foo";
void D, A, C, foo; // Use the variables to prevent ellision
/*1*/ export /*2*/ { /*3*/ A /*4*/, /*5*/ B /*6*/ as /*7*/ C /*8*/ } /*9*/ from /*10*/ "foo";
/*1*/ export /*2*/ * /*3*/ from /*4*/ "foo"