obsidianmd / obsidian-api

Type definitions for the latest Obsidian API.
https://docs.obsidian.md
MIT License
1.65k stars 192 forks source link

Add getBacklinksToFile #116

Closed mfp22 closed 1 year ago

mfp22 commented 1 year ago

If you merge this PR first, you'll see the diff for just this PR.

This PR just adds typing for getBacklinksToFile.

lishid commented 1 year ago

Private APIs are not documented because they are private. There are loads of methods and fields that exists at runtime but isn't in the API because we have not committed to supporting them through the API.

If you decide to use a private API you can do so by adding it in your own local .d.ts file in your plugin repo.

mfp22 commented 1 year ago

I would rather be broken by a change in TypeScript than a runtime JavaScript error. If I define my own types, they are lies. You should allow developers to contribute to types that describe current reality, but with the @experimental tag. I guess I know now why there are 162 forks and only 15 PRs.

lishid commented 1 year ago

I understand your perspective, but any definition identified here will get used without regard - and subsequently complained about if they were changed. Also, obsidian.d.ts is just a type definition, so it works exactly the same way as if you defined your own types.