Skip to content

Commit 036e92f

Browse files
authored
rename: ApplyContext → Scenario$ in generated types and docs
Agent-Logs-Url: https://github.com/counterfact/api-simulator/sessions/3b3f523f-aaf7-4acd-bf29-0cca1b1b16e7
1 parent 82d2824 commit 036e92f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

docs/features/repl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ After the command runs you can immediately use anything stored in `$.routes`:
9898
> routes.findSold.send()
9999
```
100100

101-
The `Scenario` type and `ApplyContext` interface are generated automatically into `types/_.context.ts` when you run Counterfact with type generation enabled.
101+
The `Scenario` type and `Scenario$` interface are generated automatically into `types/_.context.ts` when you run Counterfact with type generation enabled.
102102

103103
## See also
104104

src/typescript-generator/generate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function buildApplyContextContent(contextFiles: ContextFileInfo[]): string {
277277
" loadContext(path: string): Record<string, unknown>;",
278278
"}",
279279
"",
280-
"export interface ApplyContext {",
280+
"export interface Scenario$ {",
281281
' /** Root context, same as loadContext("/") */',
282282
` readonly context: ${contextType};`,
283283
' readonly loadContext: LoadContextDefinitions["loadContext"];',
@@ -288,7 +288,7 @@ function buildApplyContextContent(contextFiles: ContextFileInfo[]): string {
288288
"}",
289289
"",
290290
"/** A scenario function that receives the live REPL environment */",
291-
"export type Scenario = ($: ApplyContext) => Promise<void> | void;",
291+
"export type Scenario = ($: Scenario$) => Promise<void> | void;",
292292
"",
293293
"/** Interface for Context objects defined in _.context.ts files */",
294294
"export interface Context$ {",
@@ -304,8 +304,8 @@ function buildApplyContextContent(contextFiles: ContextFileInfo[]): string {
304304
}
305305

306306
/**
307-
* Writes the `types/scenario-context.ts` file, which exports the
308-
* `ApplyContext` interface used to type scenario functions.
307+
* Writes the `types/_.context.ts` file, which exports the
308+
* `Scenario$` interface used to type scenario functions.
309309
*
310310
* The interface is generated from all `_.context.ts` files found under the
311311
* `routes/` directory, providing strongly typed `loadContext()` overloads for

test/typescript-generator/generate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe("_.context type generation", () => {
7878
);
7979
expect(content).not.toContain("import type");
8080
expect(content).toContain(
81-
"export type Scenario = ($: ApplyContext) => Promise<void> | void;",
81+
"export type Scenario = ($: Scenario$) => Promise<void> | void;",
8282
);
8383
expect(content).toContain("export interface Context$ {");
8484
expect(content).toContain(

0 commit comments

Comments
 (0)