TypeScript: compiling removes unreferenced imports TypeScript: compiling removes unreferenced imports typescript typescript

TypeScript: compiling removes unreferenced imports


You can do this at the top of your file (instead of import):

/// <amd-dependency path="just/referencingthis/forpackaging" />


A nicer solution (tested with TS 1.8):

import 'just/referencingthis/forpackaging';

The amd-dependency triple-slash-directive seems to only work if there are other require imports; only having amd-dependency directives results in the TypeScript compiler generating JavaScript completely without a module definition.