Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue3: Cannot resolve symbol SelectionAreaInstance #232

Closed
lanyeeee opened this issue Aug 19, 2024 · 1 comment
Closed

Vue3: Cannot resolve symbol SelectionAreaInstance #232

lanyeeee opened this issue Aug 19, 2024 · 1 comment
Assignees
Labels
documentation Dokumentation is inadequate @viselect/vue Vue package

Comments

@lanyeeee
Copy link
Contributor

What is the problem?

I want to get the current SelectionArea-instance in Vue3.
My code is exactly the same as the sample code:

<template>
  <SelectionArea 
    class="container"
    :options="{selectables: '.selectable'}"
    ref="selectionAreaRef"
  >
    <div 
        v-for="id of 42"
        class="selectable"
        :key="id" 
        :data-key="id"
        :class="{selected: selected.has(id)}"
    />
  </SelectionArea>
</template>

<script lang="ts" setup>
import type {SelectionAreaInstance} from '@viselect/vue';
import {ref, reactive, onMounted} from 'vue';

const selected = reactive<Set<number>>(new Set());
const selectionAreaRef = ref<SelectionAreaInstance>()

onMounted(() => {
    // log current selection
    console.log(selectionAreaRef.value?.selection)
})
</script>

What is the current behavior?

Cannot resolve symbol SelectionAreaInstance
image

Please provide the steps to reproduce and create a CodeSandbox.

What is the expected behavior?

Successfully imported type SelectionAreaInstance without error

Your environment:

Toolset (vite@5.4.1 vue@3.4.38): 
Version (@viselect/vanilla": "^3.5.1):
Browser: Chrome 127.0.6533.120
OS:  Windows11
@lanyeeee lanyeeee added the unconfirmed Problem is not confirmed yet label Aug 19, 2024
@simonwep simonwep added bug Something isn't working @viselect/vue Vue package documentation Dokumentation is inadequate and removed unconfirmed Problem is not confirmed yet bug Something isn't working labels Aug 22, 2024
@simonwep
Copy link
Owner

My bad, the correct way would be to use const selectionAreaRef = ref<InstanceType<typeof SelectionArea>>();

simonwep added a commit that referenced this issue Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Dokumentation is inadequate @viselect/vue Vue package
Projects
None yet
Development

No branches or pull requests

2 participants