obsidian-typings 1.0.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/.editorconfig +15 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/dummy.ts +1 -0
- package/obsidian-ex.d.ts +3217 -0
- package/package.json +32 -0
- package/tsconfig.json +110 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
[*]
|
|
7
|
+
indent_style = space
|
|
8
|
+
indent_size = 4
|
|
9
|
+
end_of_line = crlf
|
|
10
|
+
charset = utf-8
|
|
11
|
+
trim_trailing_whitespace = false
|
|
12
|
+
insert_final_newline = false
|
|
13
|
+
|
|
14
|
+
[*.ts]
|
|
15
|
+
quote_type = single
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Fevol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
This repository contains TypeScript typings for undocumented [Obsidian](https://obsidian.md/) API functions.
|
|
2
|
+
|
|
3
|
+
There are three options for installing this package:
|
|
4
|
+
1. **Explicit type importing:** Each typing has to be imported explicitly, e.g. `import {App, MarkdownView} from "@fevol/obsidian-typings"`. <br> _Install via:_ `npm install --save-dev npm install @fevol/obsidian-typings`
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
You can add the code as a submodule to your project - or as an NPM package via `npm install --save-dev npm install @fevol/obsidian-typings`.
|
|
11
|
+
|
|
12
|
+
If you prefer to have automatic types discovery without needing to explicitly `import` current package, use `npm install --save-dev @types/obsidian-typings@npm:@fevol/obsidian-typings`
|
|
13
|
+
|
|
14
|
+
These typings contain _almost_ all of the undocumented API methods and variables, excluding those that
|
|
15
|
+
seem to be intended solely for internal use and will not be relevant for plugin development.
|
|
16
|
+
|
|
17
|
+
Please be aware that there is a good reason why the functions and types defined here are not included with the official
|
|
18
|
+
API definitions:
|
|
19
|
+
- The methods are not fully defined, and will be changed or removed in the near-future
|
|
20
|
+
- There is a high risk of the code behaving unexpectedly if used improperly
|
|
21
|
+
- The function was never meant to be used
|
|
22
|
+
|
|
23
|
+
So, please use the functions and variables provided with caution. Be prepared to update your code if the API changes,
|
|
24
|
+
and only use the functions if you are confident that you understand what they do. Reference the [official API](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts)
|
|
25
|
+
first to see if your problem may be solved with a documented function, or search
|
|
26
|
+
in the #plugin-dev channel of the Obsidian Discord server.
|
|
27
|
+
|
|
28
|
+
Furthermore, there is a very high chance that I made a mistake in the typings, despite my best efforts.
|
|
29
|
+
All the types had to be deduced from either context, manually running the function, or the minified app code.
|
|
30
|
+
You will have to verify if the code behaves as expected, both with regard to the expected types, as well as what
|
|
31
|
+
the function description says.
|
|
32
|
+
|
|
33
|
+
With all the scary disclaimers out of the way, hopefully these typings will help in removing 90% of the `@ts-ignore`s
|
|
34
|
+
you have in your codebase, or let you discover solutions that didn't seem possible before.
|
|
35
|
+
|
|
36
|
+
PR's and issue reports are welcome for missing, deprecated or incorrectly defined typings.
|
package/dummy.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// NOTE: This file is required to make `tsc` build working
|