# notion-api-types

> A typescript package template

Latest version **1.0.0** (published 2022-05-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install notion-api-types
pnpm add notion-api-types
yarn add notion-api-types
bun add notion-api-types
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-05-20 |
| First published | 2021-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 65.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Ben Keys |
| Maintainers | bkeys818 |

## Links

- npm: https://www.npmjs.com/package/notion-api-types
- Repository: https://github.com/bkeys818/notion-api-types
- npm.io page: https://npm.io/package/notion-api-types

## Recent versions

- 1.0.0 (latest) — 2022-05-20
- 0.4.2-0 (next) — 2022-02-19
- 0.4.2 — 2022-02-20
- 0.4.2-alpha.1 — 2022-02-13
- 0.4.1 — 2022-02-13
- 0.4.0 — 2022-02-13
- 0.3.0 — 2022-01-05
- 0.2.0 — 2021-12-31
- 0.1.0 — 2021-12-29

## README

# Notion API Types

> Types for the [Notion API](https://developers.notion.com)

[![Version][version-image]][version-link]
[![Downloads Stats][npm-downloads]][npm-link]
[![Run test][test-status]][test-link]

This package defines types for the Notion API responses.
It contains only `*.d.ts` files, so it won't increase the size of a compressed package.

## Installation

Yarn:

```sh
yarn add --D notion-api-types
```

## Usage

This module is built so you can import from the directories in it.
You can import the top namespaces, but it will make for long code.

```ts
import type { Page, PageProperty } from 'notion-api-types/responses'
```

Throughout the module,
[namespaces](https://www.typescriptlang.org/docs/handbook/namespaces.html)
will have plural names and
[types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-aliases)
will be singular.

```ts
import type { Page, PageProperty, PageProperties } from 'notion-api-types/responses'

const page: Page = { ... }
const props: PageProperty[] = Object.values(page.properties)
let title: PageProperties.Title
for (const prop of props)
    if (prop.type == 'title') title = prop
```

If the property type is already known use
[type assertions](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions).

```ts
import type { Page, PageProperties } from 'notion-api-types/response'

const page: Page = { ... }
const title = page.properties.Title as PageProperties.Title
```

Using
[import type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-aliases)
will keep the module from increase the size of your compiled javascript.

<!-- Markdown link & img dfn's -->

[version-image]: https://img.shields.io/github/package-json/v/bkeys818/notion-api-types/v1.0.0?label=version
[version-link]: https://github.com/bkeys818/notion-api-types/releases/tag/v1.0.0
[npm-downloads]: https://img.shields.io/npm/dm/notion-api-types.svg
[npm-link]: https://www.npmjs.com/package/notion-api-types/v/1.0.0
[test-status]: https://github.com/bkeys818/notion-api-types/actions/workflows/run-tests.yaml/badge.svg?branch=v1.0.0
[test-link]: https://github.com/bkeys818/notion-api-types/actions/workflows/run-tests.yaml

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