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
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
-
Installation
Obsidian Typings is a NPM package that you can install using your favorite package manager: -
Add
obsidian-typings
totypes
intsconfig.json
(recommended)
Register the types fromobsidian-typings
to your project with thetsconfig.json
file. -
Explicit type importing
If you prefer not to addobsidian-typings
to yourtypes
, you can also addimport 'obsidian-typings';
to any project file. -
Using
obsidian-typings/implementations
Depending on how your project is set up,import { X } from 'obsidian-typings/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
:
That’s it! Now the type definitions should be accessible in your project.