# typewags

> A typescript web API generator script.

Latest version **0.2.2** (published 2021-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install typewags
pnpm add typewags
yarn add typewags
bun add typewags
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2021-04-19 |
| First published | 2021-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 86.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Darren Daniel Day |
| Maintainers | darrendanielday |

## Links

- npm: https://www.npmjs.com/package/typewags
- Repository: https://github.com/DarrenDanielDay/typewags
- Homepage: https://github.com/DarrenDanielDay/typewags#readme
- Issues: https://github.com/DarrenDanielDay/typewags/issues
- npm.io page: https://npm.io/package/typewags

## Dependencies (1)

- [camelcase](https://npm.io/package/camelcase.md) ^6.2.0

## Recent versions

- 0.2.2 (latest) — 2021-04-19
- 0.2.1 — 2021-04-19
- 0.2.0 — 2021-04-19
- 0.1.5 — 2021-03-28
- 0.1.4 — 2021-03-07
- 0.1.3 — 2021-03-07
- 0.1.2 — 2021-03-07
- 0.1.1 — 2021-03-07
- 0.1.0 — 2021-03-07

## README

# typewags

A typescript web API generator script.

## Usage

To generate the TypeScript definitions, you need a type definition and web API information JSON.

Here is a NuGet package for `ASP.NET Core` projects to generate the JSON:

[typewags-aspnetcore](https://www.nuget.org/packages/typewags-aspnetcore)

Here is an example of usage if you followed the example of [typewags-aspnetcore](https://www.nuget.org/packages/typewags-aspnetcore).

```ts
import axios from "axios";
import path from "path";
import fs from "fs/promises";
import { WebAPIInspectResult, ApiBundleGenerator } from "typewags";

async function main() {
  const response = await axios.get<WebAPIInspectResult>(
    // If you follow the example, you can get the definition json by the following request.
    "http://localhost:5000/typewags"
  );
  const json = response.data;
  // Generate all of the definitions by a simple API.
  const generator = new ApiBundleGenerator(json);
  const declarationContent = generator.generateApiInterfaceBundle();
  await fs.writeFile(
    path.resolve(process.cwd(), "bundle.ts"),
    declarationContent
  );
}

main();
```

---
_Source: https://npm.io/package/typewags · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
