Skip to content

Getting Started

Obsidian Typings is a TypeScript library that provides type definitions for private parts of the Obsidian API. This project is not officially affiliated with Obsidian.

You will need to have a plugin template set up with a package manager and TypeScript. If you don’t have one yet, follow the “Build a plugin” guide in the official Obsidian docs to create one.

  1. Installation
    Obsidian Typings is available as scoped packages under the @obsidian-typings org on NPM. Install using your favorite package manager:

    Terminal window
    npm i -D @obsidian-typings/obsidian-public-latest

    Other install options:

    • Latest catalyst (beta) release: @obsidian-typings/obsidian-catalyst-latest
    • Specific Obsidian version: @obsidian-typings/obsidian-public-1.12.7
    • Legacy package name (alias): obsidian-typings
  2. Add the package to types in tsconfig.json (recommended)
    Register the types to your project with the tsconfig.json file.

    tsconfig.json
    {
    "compilerOptions": {
    "...": "...",
    "types": [
    "@obsidian-typings/obsidian-public-latest"
    ]
    }
    }
  3. Explicit type importing
    If you prefer not to add the package to your types, you can also add import type {} from '@obsidian-typings/obsidian-public-latest'; to any project file.

  4. Using implementations
    Depending on how your project is set up, import { X } from '@obsidian-typings/obsidian-public-latest/implementations'; may not work straight out of the box, e.g., if you have "moduleResolution": "node" or "node10" in your tsconfig.json.

    To solve this, you can add the following to your tsconfig.json:

    tsconfig.json
    {
    "compilerOptions": {
    "...": "...",
    "paths": {
    "@obsidian-typings/obsidian-public-latest/implementations": [
    "./node_modules/@obsidian-typings/obsidian-public-latest/implementations.d.ts",
    "./node_modules/@obsidian-typings/obsidian-public-latest/implementations.cjs"
    ]
    }
    }
    }

That’s it! Now the type definitions should be accessible in your project.