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.
Prerequisites
Section titled “Prerequisites”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.
Installation
Section titled “Installation”-
Installation
Obsidian Typings is available as scoped packages under the@obsidian-typingsorg on NPM. Install using your favorite package manager:Terminal window npm i -D @obsidian-typings/obsidian-public-latestTerminal window yarn add -D @obsidian-typings/obsidian-public-latestTerminal window pnpm add -D @obsidian-typings/obsidian-public-latestTerminal window bun add -d @obsidian-typings/obsidian-public-latestOther 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
- Latest catalyst (beta) release:
-
Add the package to
typesintsconfig.json(recommended)
Register the types to your project with thetsconfig.jsonfile.tsconfig.json {"compilerOptions": {"...": "...","types": ["@obsidian-typings/obsidian-public-latest"]}} -
Explicit type importing
If you prefer not to add the package to yourtypes, you can also addimport type {} from '@obsidian-typings/obsidian-public-latest';to any project file. -
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 yourtsconfig.json.
To solve this, you can add the following to yourtsconfig.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.