refactor(examples/vue): type the 'isVisited' prop with 'PropType' and… · TanStack/query@c76c0ff · GitHub
Skip to content

Commit c76c0ff

Browse files
authored
refactor(examples/vue): type the 'isVisited' prop with 'PropType' and the visited posts set with 'Set<number>' (#12143)
1 parent d9e7648 commit c76c0ff

10 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎examples/vue/2.6-basic/src/App.vue‎

Lines changed: 1 addition & 1 deletion

‎examples/vue/2.6-basic/src/Posts.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { defineComponent } from '@vue/composition-api'
33
import { useQuery } from '@tanstack/vue-query'
4+
import type { PropType } from '@vue/composition-api'
45
56
import type { Post } from './types'
67
@@ -14,7 +15,7 @@ export default defineComponent({
1415
name: 'PostsList',
1516
props: {
1617
isVisited: {
17-
type: Function,
18+
type: Function as PropType<(id: number) => boolean>,
1819
required: true,
1920
},
2021
},

‎examples/vue/2.7-basic/src/App.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineComponent({
88
name: 'App',
99
components: { Posts, Post },
1010
setup() {
11-
const visitedPosts = ref(new Set())
11+
const visitedPosts = ref(new Set<number>())
1212
const isVisited = (id: number) => visitedPosts.value.has(id)
1313
1414
const postId = ref(-1)

‎examples/vue/2.7-basic/src/Posts.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { defineComponent } from 'vue'
33
import { useQuery } from '@tanstack/vue-query'
4+
import type { PropType } from 'vue'
45
56
import type { Post } from './types'
67
@@ -14,7 +15,7 @@ export default defineComponent({
1415
name: 'PostsList',
1516
props: {
1617
isVisited: {
17-
type: Function,
18+
type: Function as PropType<(id: number) => boolean>,
1819
required: true,
1920
},
2021
},

‎examples/vue/basic/src/App.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineComponent({
99
name: 'App',
1010
components: { Posts, Post, VueQueryDevtools },
1111
setup() {
12-
const visitedPosts = ref(new Set())
12+
const visitedPosts = ref(new Set<number>())
1313
const isVisited = (id: number) => visitedPosts.value.has(id)
1414
1515
const postId = ref(-1)

‎examples/vue/basic/src/Posts.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { defineComponent } from 'vue'
33
import { useQuery } from '@tanstack/vue-query'
4+
import type { PropType } from 'vue'
45
56
import type { Post } from './types'
67
@@ -14,7 +15,7 @@ export default defineComponent({
1415
name: 'PostsList',
1516
props: {
1617
isVisited: {
17-
type: Function,
18+
type: Function as PropType<(id: number) => boolean>,
1819
required: true,
1920
},
2021
},

‎examples/vue/dependent-queries/src/App.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineComponent({
88
name: 'App',
99
components: { Posts, Post },
1010
setup() {
11-
const visitedPosts = ref(new Set())
11+
const visitedPosts = ref(new Set<number>())
1212
const isVisited = (id: number) => visitedPosts.value.has(id)
1313
1414
const postId = ref(-1)

‎examples/vue/dependent-queries/src/Posts.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { defineComponent } from 'vue'
33
import { useQuery } from '@tanstack/vue-query'
4+
import type { PropType } from 'vue'
45
56
import type { Post } from './types'
67
@@ -14,7 +15,7 @@ export default defineComponent({
1415
name: 'PostsList',
1516
props: {
1617
isVisited: {
17-
type: Function,
18+
type: Function as PropType<(id: number) => boolean>,
1819
required: true,
1920
},
2021
},

‎examples/vue/persister/src/App.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default defineComponent({
88
name: 'App',
99
components: { Posts, Post },
1010
setup() {
11-
const visitedPosts = ref(new Set())
11+
const visitedPosts = ref(new Set<number>())
1212
const isVisited = (id: number) => visitedPosts.value.has(id)
1313
1414
const postId = ref(-1)

‎examples/vue/persister/src/Posts.vue‎

Lines changed: 2 additions & 1 deletion

0 commit comments

Comments
 (0)