Skip to content

Commit

Permalink
Fix incorrect method name.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Dec 5, 2023
1 parent 576cef0 commit 71a704c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ words:
- jsyaml
- keyer
- lzutf
- mocharc
- msbuild
- MSRC
- multis
Expand Down
6 changes: 3 additions & 3 deletions docs/extending-typespec/emitter-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Let's walk through each of these types in turn.

The asset emitter is responsible for driving the emit process. It has methods for taking TypeSpec types to emit, and maintains the state of your current emit process including the declarations you've accumulated, current emit context, and converting your emitted content into files on disk.

To create your asset emitter, call `createAssetEmitter` on your emit context in `$onEmit`. It takes the TypeEmitter which is covered in the next section. Once created, you can call `emitProgram()` to emit every type in the TypeSpec graph. Otherwise, you can call `emitType(someType)` to emit specific types instead.
To create your asset emitter, call `getAssetEmitter` on your emit context in `$onEmit`. It takes the TypeEmitter which is covered in the next section. Once created, you can call `emitProgram()` to emit every type in the TypeSpec graph. Otherwise, you can call `emitType(someType)` to emit specific types instead.

```typescript
export async function $onEmit(context: EmitContext) {
const assetEmitter = context.createAssetEmitter(MyTypeEmitter);
const assetEmitter = context.getAssetEmitter(MyTypeEmitter);

// emit my entire typespec program
assetEmitter.emitProgram();
Expand Down Expand Up @@ -59,7 +59,7 @@ class MyCodeEmitter extends CodeTypeEmitter {
}
```

Passing this to `createAssetEmitter` and calling `assetEmitter.emitProgram()` will console.log all the models in the program.
Passing this to `getAssetEmitter` and calling `assetEmitter.emitProgram()` will console.log all the models in the program.

#### EmitterOutput

Expand Down

0 comments on commit 71a704c

Please sign in to comment.