obsidian-typings 5.24.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,206 +1,18 @@
1
- # Obsidian Typings
2
-
3
- [![NPM downloads](https://img.shields.io/npm/v/obsidian-typings?color=red&label=Version%3A&logo=npm&logoColor=white&labelColor=red)](https://www.npmjs.com/package/obsidian-typings)
4
- [![NPM downloads](https://img.shields.io/npm/dw/obsidian-typings?style=flat&label=Downloads)](https://www.npmjs.com/package/obsidian-typings)
5
- [![GitHub Repo stars](https://img.shields.io/github/stars/obsidian-typings/obsidian-typings?color=yellow&label=Stargazers%3A&logo=OpenTelemetry&logoColor=yellow)](https://github.com/obsidian-typings/obsidian-typings/stargazers)
6
-
7
- **Obsidian Typings** provides **TypeScript definitions** for Obsidian’s **undocumented and internal APIs**.
8
-
9
- It extends the official [Obsidian API](https://github.com/obsidianmd/obsidian-api/) with:
10
-
11
- - Additional type definitions for internal methods, properties, and plugins.
12
- - Explanations and usage examples to make undocumented parts easier to understand.
13
- - Helper utilities and interfaces for working with Obsidian’s internals in a safer, type-safe way.
14
-
15
- This package is designed for plugin developers who want to access Obsidian's internal APIs in a type-safe manner,
16
- while also keeping their code maintainable and less reliant on `@ts-ignore`/`@ts-expect-error`.
17
-
18
- > [!IMPORTANT]
19
- >
20
- > - This package is **not affiliated with, or endorsed by, the Obsidian team**.
21
- > - It does **not** cover every aspect of the Obsidian API.
22
- > - Typings are based on reverse engineering and may be **inaccurate or unstable**. They can change without notice in future releases.
23
- > - Always **test thoroughly** and **add fallbacks** when using internal APIs.
24
-
25
- ## Versioning and Release Channels
26
-
27
- [Obsidian](https://obsidian.md) has two main release channels:
28
-
29
- - `public` - stable versions available to all users.
30
- - [`catalyst`](https://help.obsidian.md/catalyst) (`beta`, `early access`) - versions only available to users with a catalyst license, has early access to new features.
31
-
32
- If you use internal APIs, you may need to support users on both channels.
33
- The availability or behavior of some APIs can differ between versions, which may lead to bugs or errors if these changes are not accounted for in your plugin.
34
-
35
- To make it easier to adapt to these differences, this package provides typings for both channels.
36
-
37
- Typings for each `Obsidian` version can be found in their own git branches: namely `release/obsidian-public/*` and `release/obsidian-catalyst/*`:
38
-
39
- - Latest `public` release: [`release/obsidian-public/1.12.7`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-public/1.12.7) | [`@obsidian-typings/obsidian-public-1.12.7`](https://www.npmjs.com/package/@obsidian-typings/obsidian-public-1.12.7)
40
- - Latest `catalyst` release: [`release/obsidian-catalyst/1.12.6`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-catalyst/1.12.6) | [`@obsidian-typings/obsidian-catalyst-1.12.6`](https://www.npmjs.com/package/@obsidian-typings/obsidian-catalyst-1.12.6)
41
-
42
- Older versions of the package are available, but support for them is limited.
43
- In most cases, we recommend to always use the latest release.
44
-
45
- ## Set-up
46
-
47
- ### 1. Install via `npm`
48
-
49
- - Latest `public` release (recommended):
50
- - `npm install --save-dev @obsidian-typings/obsidian-public-latest`
51
- - Latest `catalyst` (`beta`) release:
52
- - `npm install --save-dev @obsidian-typings/obsidian-catalyst-latest`
53
- - Specific Obsidian version (should match `minAppVersion` in your plugin's `manifest.json`):
54
- - `npm install --save-dev @obsidian-typings/obsidian-public-1.12.7`
55
- - `npm install --save-dev @obsidian-typings/obsidian-catalyst-1.12.6`
56
- - Legacy package name (alias for `@obsidian-typings/obsidian-public-latest`):
57
- - `npm install --save-dev obsidian-typings`
58
-
59
- <!-- markdownlint-disable MD033 -->
60
-
61
- ### 2. Enable in `tsconfig.json` (recommended) <span id="add-types-setting-to-tsconfig-json"></span>
62
-
63
- <!-- markdownlint-enable MD033 -->
64
-
65
- Add the package to the `types` array of your `tsconfig.json` to make all extended typings available globally without explicit importing them:
66
-
67
- ```json
68
- {
69
- "compilerOptions": {
70
- "...": "...",
71
- "types": [
72
- "@obsidian-typings/obsidian-public-latest"
73
- ]
74
- }
75
- }
76
- ```
77
-
78
- > [!WARNING]
79
- >
80
- > If other `@types/*` packages stop being recognized after adding the typings to the `types`, you may need to re-add them to the `types` list.
81
- >
82
- > ```json
83
- > {
84
- > "compilerOptions": {
85
- > "...": "...",
86
- > "types": [
87
- > "@obsidian-typings/obsidian-public-latest",
88
- > "some-package-name"
89
- > ]
90
- > }
91
- > }
92
-
93
- ### 3. Importing explicitly (alternative)
94
-
95
- Instead of adding the package to your `types`, you can also import it directly:
96
-
97
- ```ts
98
- import type {} from '@obsidian-typings/obsidian-public-latest';
99
- ```
100
-
101
- ## Usage
102
-
103
- ### `obsidian` module internals
1
+ <center>
104
2
 
105
- To access types from the `obsidian` module, the import syntax does not change:
106
-
107
- ```ts
108
- import type { App } from 'obsidian';
109
-
110
- function printInternalPlugins(app: App): void {
111
- console.log(app.internalPlugins);
112
- }
113
- ```
114
-
115
- ### Additional interfaces
116
-
117
- Additional interfaces added by this package (which do not exist in the official API), can be imported as:
118
-
119
- ```ts
120
- import type { InternalPlugins } from '@obsidian-typings/obsidian-public-latest';
121
-
122
- function getInternalPlugins(app: App): InternalPlugins {
123
- return app.internalPlugins;
124
- }
125
- ```
126
-
127
- ### Implementations
128
-
129
- Additional helper functions/types/... added by this package can be used by importing from the `/implementations` subpath:
130
-
131
- ```ts
132
- import { InternalPluginName } from '@obsidian-typings/obsidian-public-latest/implementations';
133
-
134
- // If you forget the `/implementations` part:
135
- // import { InternalPluginName } from '@obsidian-typings/obsidian-public-latest';
136
- // You will not be able to use the runtime values and the code below will not compile.
137
-
138
- this.app.internalPlugins.getEnabledPluginById(InternalPluginName.FileExplorer);
139
- ```
140
-
141
- The list of all available implementations can be found in the `src/obsidian/implementations` folder in the corresponding release branch ([example for `1.9.10 public`](https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-public/1.9.10/src/obsidian/implementations)).
142
-
143
- ### Extend with your own typings
144
-
145
- If you need to extend the typings provided by this package, add the following to any `.d.ts` file in your project:
146
-
147
- ```ts
148
- export {}; // This line is required. If there are no top-level `import/export` statements, your typings will work not as expected.
149
- declare module '@obsidian-typings/obsidian-public-latest' {
150
- interface PluginsPluginsRecord {
151
- ['my-plugin-id']: MyPlugin;
152
- }
153
- }
154
- ```
155
-
156
- ## Disclaimer
157
-
158
- > [!WARNING]
159
- >
160
- > Make sure to read below section in detail before using these typings.
161
- >
162
- > Use at your own risk, verify that the code behaves as expected, and be prepared to update your code if the API changes.
163
-
164
- Please be aware that there is a good reason why (some of) the functions and types defined here are not included with the official API definitions:
3
+ # Obsidian Typings
165
4
 
166
- - The methods are not fully defined, and will be changed or removed in the near-future
167
- - There is a high risk of the code behaving unexpectedly if used improperly
168
- - The function was never meant to be used
5
+ </center>
169
6
 
170
- Please use the functions and variables provided by this package with caution.
171
- Be prepared to update your code if the API changes, and only use the functions if you are confident that you understand what they will do.
172
- Reference the [official API](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts) first to see if your problem may be solved with a documented function, or search in the `#plugin-dev` channel of the Obsidian Discord server.
173
- Some functions will also contain `@remark` TSDoc tags that provide alternatives or better solutions.
7
+ <div align="center">
8
+ <a href="https://obsidian.md/changelog/2026-03-23-desktop-v1.12.7/"><img src="https://img.shields.io/badge/Obsidian_version-1.12.7_public-blue?logo=obsidian" alt="Obsidian version: 1.12.7 public"></a>
9
+ <a href="https://github.com/obsidian-typings/obsidian-typings/tree/release/obsidian-public/1.12.7"><img src="https://img.shields.io/badge/Git_branch-release/obsidian--public/1.12.7-red?logo=git" alt="Git branch: release/obsidian-public/1.12.7"></a>
10
+ </div>
174
11
 
175
- Furthermore, there is a very high chance that there are mistakes in the typings, despite best efforts.
176
- All types had to be deduced from context, manually running the function, or from the minified app code.
177
- Always verify that your code behaves as expected, both in terms of types and runtime behavior.
12
+ This branch contains the typings for Obsidian version [`1.12.7 public`](https://obsidian.md/changelog/2026-03-23-desktop-v1.12.7/).
178
13
 
179
14
  > [!WARNING]
180
15
  >
181
- > While the typings themselves were hand-written by the package maintainers and contributors, the majority of the `@tsdoc` documentation has been minimally completed using generative AI and may be inaccurate.
182
-
183
- &nbsp;
184
-
185
- > [!TIP]
186
- >
187
- > If you find any issues with the typings or documentation, please feel free to [open an issue](https://github.com/obsidian-typings/obsidian-typings/issues) or submit a pull request.
188
-
189
- With these scary disclaimers out of the way, hopefully these typings will help you in removing 90% of the `@ts-ignore`/`@ts-expect-error` you have in your codebase, or discover solutions that didn't seem possible before.
190
-
191
- ## Tags
192
-
193
- - `@remark` warnings, caveats, or suggested alternatives.
194
- - `@tutorial` extra guidance and examples.
195
- - `@official` comes from the [official API](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts).
196
- - `@unofficial` based on reverse engineering.
197
-
198
- ## Migration
199
-
200
- If you were using a `1.x.x` version of this package, see the [Migration guide](https://github.com/obsidian-typings/obsidian-typings/blob/main/MIGRATION.md) for upgrading to `2.0.0` or newer.
201
-
202
- ## Contributing
203
-
204
- Feel free to start typing any part of the Obsidian API that is not yet typed, or fixing/adding additional descriptions to existing typings. If you are unsure about anything, don't hesitate to open an issue.
16
+ > If you are making a PR to this branch, please make sure to verify that all your changes are applicable to this version.
205
17
 
206
- A brief tutorial is available on how you can get started with adding new typings, or fixing existing ones, see: [CONTRIBUTING.md](https://github.com/obsidian-typings/obsidian-typings/blob/main/CONTRIBUTING.md).
18
+ [See full docs](https://github.com/obsidian-typings/obsidian-typings/blob/main/README.md)
@@ -1 +1 @@
1
- export type * from "@obsidian-typings/obsidian-public-latest/implementations";
1
+ export * from "@obsidian-typings/obsidian-public-latest/implementations";
@@ -1 +1 @@
1
- export type * from "@obsidian-typings/obsidian-public-latest/implementations";
1
+ export * from "@obsidian-typings/obsidian-public-latest/implementations";
package/package.json CHANGED
@@ -1,26 +1,16 @@
1
1
  {
2
2
  "dependencies": {
3
- "@obsidian-typings/obsidian-public-latest": "^5.24.0"
3
+ "@obsidian-typings/obsidian-public-latest": "^6.1.0"
4
4
  },
5
5
  "description": "TypeScript type definitions for Obsidian's internal/unofficial APIs. Wrapper for @obsidian-typings/obsidian-public-latest.",
6
6
  "exports": {
7
7
  ".": {
8
- "import": {
9
- "types": "./types.d.mts"
10
- },
11
- "require": {
12
- "types": "./types.d.cts"
13
- }
8
+ "import": { "types": "./types.d.mts" },
9
+ "require": { "types": "./types.d.cts" }
14
10
  },
15
11
  "./implementations": {
16
- "import": {
17
- "default": "./implementations.mjs",
18
- "types": "./implementations.d.mts"
19
- },
20
- "require": {
21
- "default": "./implementations.cjs",
22
- "types": "./implementations.d.cts"
23
- }
12
+ "import": { "default": "./implementations.mjs", "types": "./implementations.d.mts" },
13
+ "require": { "default": "./implementations.cjs", "types": "./implementations.d.cts" }
24
14
  }
25
15
  },
26
16
  "license": "MIT",
@@ -28,5 +18,5 @@
28
18
  "name": "obsidian-typings",
29
19
  "type": "module",
30
20
  "types": "./types.d.cts",
31
- "version": "5.24.0"
21
+ "version": "6.1.0"
32
22
  }