title: How to access `app.config.globalProperties` in a`<script setup lang="ts">`?
body: <p>how to access <code>app.config.globalProperties</code>  withing <code>&lt;script setup lang=&quot;ts&quot;&gt;</code> ?</p>
  <p>I have looked around for several approaches: <a href="https://stackoverflow.com/questions/64175742/using-globalproperties-in-vue-3-and-typescript/64189046#64189046">like this SO post</a>, and tried to combine elements below:</p>
  <pre class="lang-js prettyprint-override"><code>\\ main.ts
  
  import mitt from 'mitt'
  const emitter = mitt()
  
  declare module '@vue/runtime-core' {
    export interface ComponentCustomProperties {
      emitter: typeof mitt
    }
  }
  
  app.config.globalProperties.emitter = emitter
  </code></pre>
  <p>tried packaging for use in composition-api .. no luck either</p>
  <pre class="lang-js prettyprint-override"><code>\\ bus.ts
  
  import { getCurrentInstance } from 'vue'
  
  const app = getCurrentInstance()
  const bus = app.appContext.config.globalProperties.emitter // app is undefined
  
  export const useBus = () =&gt; ({ bus })
  
  </code></pre>