How to get object attributes from an async function using Ghost's api in Typescript


  • How was Ghost installed and configured? - Yarn using the documentation provided
  • What Node version, database, OS & browser are you using? : v14.17.1, Ubuntu, Brave
  • What errors or information do you see in the console? ; Property ‘posts’ does not exist on type ‘{ browse: BrowseFunction; read: ReadFunction; }’.ts(2339)
  • What steps could someone else take to reproduce the issue you’re having? : Use typescript to get ghost objects.

I am using Ghost’s api from inside the getPosts() function which requires promises. However I am lost on how to get the attributes from within the promise.
I am currently getting the error from typescript: Property ‘posts’ does not exist on type browse: BrowseFunction; read: ReadFunction.ts(2339)

Where the Poster const is seen as Promise by the compiler.

Am I supposed to make the function calling getposts async? If so how would I call it from my app.ts?

    // eslint-disable-next-line import/no-anonymous-default-export
  async function getPosts() {
  return api.posts
  .browse({limit: 5, include: ['tags', 'authors']})
  .then((posts) => {
      posts.forEach((post) => {
  .catch((err) => {

   function AboutPage() {
    const Poster= await getPosts()
    const rank= api.posts
    return (
      <Content className="site-layout aboutPage">
         <img src={rank} alt="Feature 01" />

  export default AboutPage;```