Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
18971cc
TypescriptAPI add typescript argument to constructor and an async sta…
RobinTail Dec 27, 2025
b2143db
Moving static async creator into the Integration. Base requires Types…
RobinTail Dec 27, 2025
4c75150
Changing ids and inerfaces props to records of strings.
RobinTail Dec 27, 2025
f4c42f4
Introducing makeId() helper.
RobinTail Dec 27, 2025
4c8b2ee
Utilizing makeId() where needed as an argument of bare factory.
RobinTail Dec 27, 2025
fa8257f
Changing to a method: makeMethodType().
RobinTail Dec 27, 2025
7b799be
Changing to a method: makeSomeOfType().
RobinTail Dec 27, 2025
fd162ae
Changing to a method: makeRequestType().
RobinTail Dec 27, 2025
eda11ab
Changeing makeDeconstruction() to accept strings.
RobinTail Dec 27, 2025
30ab198
Changeing makeTemplate() to accept id as a string.
RobinTail Dec 27, 2025
e7c8aa5
Changeing: makePublicMethod() to accept name as a string.
RobinTail Dec 27, 2025
8160d23
Adjusting makeAssignment() to accept string as the left side.
RobinTail Dec 27, 2025
c618bb5
Adjusting makeTernary() to accept string args for ids.
RobinTail Dec 27, 2025
0546c61
Adjusting call for f.createAsExpression().
RobinTail Dec 27, 2025
8257ff4
Changing makeSearchParams to accept string id.
RobinTail Dec 27, 2025
0dc2a79
Changing makeParam() to accept string initId.
RobinTail Dec 27, 2025
1f21440
Adjusting usage of f.createForInStatement().
RobinTail Dec 27, 2025
e0de644
Changing makeCall() to accept string ids as final args.
RobinTail Dec 27, 2025
cafa0c3
Adjusting example generator.
RobinTail Dec 27, 2025
12723a4
Adjusting tests.
RobinTail Dec 27, 2025
664cbd9
REF: TypescriptAPI instantiated by IntegrationBase::constructor().
RobinTail Dec 27, 2025
2be687a
Making typescript an optional peer and adjusting documentation accord…
RobinTail Dec 27, 2025
96375ec
Ref: rm unneccessary binding when using class props assigned with fun…
RobinTail Dec 27, 2025
7a83d49
Merge branch 'make-v27' into async-load-ts-integration
RobinTail Dec 27, 2025
a1aed8e
Merge branch 'make-v27' into async-load-ts-integration
RobinTail Dec 27, 2025
a3136e5
Changelog: add to 27.0.0.
RobinTail Dec 27, 2025
0121ac2
Add basic migration script for Integration class instance with ts in …
RobinTail Dec 27, 2025
ea6a1dc
Simpler implementation: add import to the top of the file.
RobinTail Dec 28, 2025
0a76baa
feat: Prefer to await create() in async context.
RobinTail Dec 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Install the framework, its peer dependencies and type assistance packages using

```shell
# example for pnpm:
pnpm add express-zod-api express zod typescript http-errors
pnpm add express-zod-api express zod http-errors
pnpm add -D @types/express @types/node @types/http-errors
```

Expand Down Expand Up @@ -1074,13 +1074,15 @@ adding the runtime helpers the framework relies on.

## Generating a Frontend Client

You can generate a Typescript file containing the IO types of your API and a client for it.
Consider installing `prettier` and using the async `printFormatted()` method.
You can generate a Typescript file containing the IO types of your API and a client for it. Make sure you have
`typescript` installed. Consider also installing `prettier` and using the async `printFormatted()` method.

```ts
import typescript from "typescript";
import { Integration } from "express-zod-api";

const client = new Integration({
typescript, // or await Integration.create() to delegate importing
routing,
config,
variant: "client", // <— optional, see also "types" for a DIY solution
Expand Down
4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ const tsFactoryConcerns = [
selector: "Identifier[name='createUnionTypeNode']",
message: "use makeUnion() helper",
},
{
selector: "Identifier[name='createIdentifier']",
message: "use makeId() helper",
},
];

export default tsPlugin.config(
Expand Down
2 changes: 2 additions & 0 deletions example/generate-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { writeFile } from "node:fs/promises";
import { Integration } from "express-zod-api";
import { routing } from "./routing";
import { config } from "./config";
import typescript from "typescript";

await writeFile(
"example.client.ts",
await new Integration({
typescript,
routing,
config,
serverUrl: `http://localhost:${config.http!.listen}`,
Expand Down
3 changes: 3 additions & 0 deletions express-zod-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
},
"express-fileupload": {
"optional": true
},
"typescript": {
"optional": true
}
},
"devDependencies": {
Expand Down
Loading