Skip to content

Show Emitted Files

Running a Twoslash code sample is a full TypeScript compiler run, and that run will create files inside the virtual file system. You can replace the contents of your code sample with the results of running TypeScript over the project.

@showEmit

// @showEmit is the main command to tell Twoslash that you want to replace the output of your code sample with the equivalent .js file.

**No example available**

Would show the .js file which this .ts file represents. You can see TypeScript add ‘use strict’ and : string is removed from the output.

@showEmittedFile: [file]

While the .js file is probably the most useful file out of the box, TypeScript does emit other files if you have the right flags enabled (.d.ts and .map) but also when you have a multi-file code sample - you might need to tell Twoslash which file to show. For all these cases you can also add @showEmittedFile: [file] to tell Twoslash which file you want to show.

.d.ts files

**No example available**

.map for .d.ts files

**No example available**

Multi-file code samples

**No example available**