Skip to content

How to import TypeScript types? #1075

Answered by neet
dccarmo asked this question in Q&A
Apr 11, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @dccarmo, thank you for posting a question

Basically, all types are exported under mastodon namespace due to the naming convention. This is because some entity has breaking changes between different versions. For example, if you want to use Status type:

import type { mastodon } from "masto";

function statusHandler(status: mastodon.v1.Status) {
  //...
}

I'm planning improve the document in the future for easily understanding this restriction.

Hope this helps

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dccarmo
Comment options

Answer selected by dccarmo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants