# @tealina/doc-types

> API document type designed for transformation tools

Latest version **1.1.0** (published 2025-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tealina/doc-types
pnpm add @tealina/doc-types
yarn add @tealina/doc-types
bun add @tealina/doc-types
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-11-29 |
| First published | 2023-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Neo Yeo |
| Maintainers | neo.yung |
| Keywords | tealina |

## Links

- npm: https://www.npmjs.com/package/@tealina/doc-types
- npm.io page: https://npm.io/package/@tealina/doc-types

## Recent versions

- 1.1.0 (latest) — 2025-11-29
- 1.1.0-beta.0 (beta) — 2025-08-27
- 1.0.2 — 2023-11-25
- 1.0.1 — 2023-11-19
- 1.0.0 — 2023-11-19
- 0.0.1 — 2023-10-12

## README

API document type designed for transformation tools

#### Pre-knowledge

> There's a package call [tealina](https://www.npmjs.com/package/tealina), it offer some CLI commands make create API service more easier, one of the command is `tealina gdoc`, it generate a `doc.json` file.

### Install

> Should be add as dependencies, not devDependencies, because the DocKind is exported as const object

```bash
pnpm add @tealina/doc-types

yarn add @tealina/doc-types

bun add @tealina/doc-types

npm i @tealina/doc-types
```

### Demo

<!-- prettier-ignore-start -->
```json
//doc.json
{
  "apis": {
    "get": { // http method
      "health": { // endpoind
        "response": {// DocNode
          "kind": 4, // DocKind
          "id": 268 
        },
      }
    }
  },
  "entityRefs": {
    "268": {
      "name": "{ status: string; }",
      "props": [
        {
          "kind": 0,// DocKind
          "type": "string",
          "name": "status"
        }
      ]
    }
  }
}
```
<!-- prettier-ignore-end -->

#### Every `DocNode` has a `kind` property, it's easy to code with switch case.

```tsx

import { DocNode, DocKind, EntityRef } from '@tealina/doc-types'

function tranform2span(docNode:DocNode){
  switch(docNode.kind){
    case DocKind.Primitive:
      return <span>{docNode.type}</span>
    ...
  }
}

```

### Convention

The name of your package should have a clear name with tealina-doc prefix.

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