This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

notion-api-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Notion API Types

Types for the Notion API

Version Downloads Stats Run test

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:

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.

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

Throughout the module, namespaces will have plural names and types will be singular.

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.

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

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

Using import type will keep the module from increase the size of your compiled javascript.

/notion-api-types/

    Package Sidebar

    Install

    npm i notion-api-types

    Weekly Downloads

    93

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    67.1 kB

    Total Files

    75

    Last publish

    Collaborators

    • bkeys818