title: How to use an array defined in Pinia store?
body: <p>I created a store in order to use the User resource, and that store has an array of roles. What I am trying to do is to search for a specific role in that array. I tried to use the Array functions, but it does not work with PropType&lt;T[]&gt;.</p>
  <pre><code>import router from &quot;@/router&quot;;
  import axios from 'axios';
  import { defineStore } from &quot;pinia&quot;;
  import { PropType } from &quot;vue&quot;;
  import { ApplicationConstants } from '../utils/Constants';
  
  type Role = {
      name: string;
  }
  
  export const useUserStore = defineStore('user', {
      state: () =&gt; ({
          currentUserId: Number,
          currentUserUsername: String,
          currentUserRoles: Array as PropType&lt;Role[]&gt;,
          isLoggedIn: false
      }),
      getters: {
          getCurrentUserId: (state) =&gt; state.currentUserId,
          getCurrentUsername: (state) =&gt; state.currentUserUsername,
          getCurrentUserRoles: (state) =&gt; state.currentUserRoles,
          isUserLoggedIn: (state) =&gt; state.isLoggedIn,
          // hasCurrentUserRole: (state) =&gt; { return (role: String | Role) ????} 
      },
      actions: {
          logIn(username: string, password: string) {
              const authDTO = {
                  &quot;username&quot; : username,
                  &quot;password&quot; : password
                  }
                  const loginResponse = axios({
                      method: 'post',
                      url: ApplicationConstants.API_LOGIN_URL,
                      data: authDTO
                  }).then((loginResponse) =&gt; {
                      /** Set JWT access token in LocalStorage. */
                      const token = loginResponse.headers[&quot;access-token&quot;];
                      localStorage.setItem(&quot;accessToken&quot;, token);
                      /** Set current user credentials. */
                      this.currentUserId = loginResponse.data.id;
                      this.currentUserUsername = loginResponse.data.username;
                      this.currentUserRoles = loginResponse.data.roles;
                      this.isLoggedIn = true;
                      /** Go to Home page. */
                      console.log(&quot;inside login in userstore&quot;);
                      router.push(&quot;/&quot;);
                  }).catch((error) =&gt; {
                      
                  });
          },
          logOut() {
              this.$reset();
              this.isLoggedIn = false;
              router.push(&quot;/login&quot;);
          },
          containsRole (roleName: String | Role)  {
              // how??
          }
      }
  });
  </code></pre>
  <p>I am using Vue3 with Composition API, and Typescript.</p>