
Emit 
 Author:Anda Toshiki
 Updated:a day ago
 Words:264
 Reading:1 min
Running a Twoslash code example is a full TypeScript compiler run that will create files inside the virtual file system. You can replace the contents of your code examples with the results of running TypeScript over the project.
@showEmit 
// @showEmit is the main command to tell Shiki Twoslash that you want to replace the output of your code example with the equivalent .js file.
ts
ts
ts
md
```ts twoslash
// @showEmit
const level: string = 'Danger'
``````ts twoslash
// @showEmit
const level: string = 'Danger'
```@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.
Shows emitted .d.ts for a TypeScript code example:
md
```ts twoslash
// @declaration
// @showEmit
// @showEmittedFile: index.d.ts
export const hello = 'world'
``````ts twoslash
// @declaration
// @showEmit
// @showEmittedFile: index.d.ts
export const hello = 'world'
```ts
ts
ts
Shows emitted .map files:
md
```ts twoslash
// @sourceMap
// @showEmit
// @showEmittedFile: index.js.map
export const hello = 'world'
``````ts twoslash
// @sourceMap
// @showEmit
// @showEmittedFile: index.js.map
export const hello = 'world'
```ts
ts
ts
md
```ts twoslash
// @declaration
// @declarationMap
// @showEmit
// @showEmittedFile: index.d.ts.map
export const hello = 'world'
``````ts twoslash
// @declaration
// @declarationMap
// @showEmit
// @showEmittedFile: index.d.ts.map
export const hello = 'world'
```ts
ts
ts
 Toshiki's Note
Toshiki's Note