|
1 | 1 | <template>
|
2 | 2 | <!-- number -->
|
3 |
| - <div v-for="(val, key) in 10"> |
| 3 | + <div v-for="(val, index) in 10"> |
4 | 4 | {{ exactType(val, {} as number) }}
|
5 |
| - {{ isNotAnyOrUndefined(val) }} |
6 |
| - {{ exactType(key, {} as number) }} |
7 |
| - {{ isNotAnyOrUndefined(key) }} |
| 5 | + {{ exactType(index, {} as number) }} |
8 | 6 | </div>
|
9 | 7 | <!-- string -->
|
10 |
| - <div v-for="(val, key) in 'foo'"> |
| 8 | + <div v-for="(val, index) in 'foo'"> |
11 | 9 | {{ exactType(val, {} as string) }}
|
12 |
| - {{ isNotAnyOrUndefined(val) }} |
13 |
| - {{ exactType(key, {} as number) }} |
14 |
| - {{ isNotAnyOrUndefined(key) }} |
| 10 | + {{ exactType(index, {} as number) }} |
15 | 11 | </div>
|
16 | 12 | <!-- array -->
|
17 |
| - <div v-for="(val, key) in arr"> |
| 13 | + <div v-for="(val, index) in arr"> |
18 | 14 | {{ exactType(val, {} as 'a' | 'b') }}
|
19 |
| - {{ isNotAnyOrUndefined(val) }} |
20 |
| - {{ exactType(key, {} as number) }} |
21 |
| - {{ isNotAnyOrUndefined(key) }} |
| 15 | + {{ exactType(index, {} as number) }} |
22 | 16 | </div>
|
23 | 17 | <!-- map -->
|
24 |
| - <div v-for="(val, key) in map"> |
| 18 | + <div v-for="(val, index) in map"> |
25 | 19 | {{ exactType(val, {} as [string, number]) }}
|
26 |
| - {{ isNotAnyOrUndefined(val) }} |
27 |
| - {{ exactType(key, {} as number) }} |
28 |
| - {{ isNotAnyOrUndefined(key) }} |
| 20 | + {{ exactType(index, {} as number) }} |
29 | 21 | </div>
|
30 | 22 | <!-- obj -->
|
31 |
| - <div v-for="(val, key) in obj"> |
| 23 | + <div v-for="(val, key, index) in obj"> |
32 | 24 | {{ exactType(val, {} as string | number) }}
|
33 |
| - {{ isNotAnyOrUndefined(val) }} |
34 | 25 | {{ exactType(key, {} as 'a' | 'b') }}
|
35 |
| - {{ isNotAnyOrUndefined(key) }} |
| 26 | + {{ exactType(index, {} as number) }} |
36 | 27 | </div>
|
37 | 28 | <!-- objUnion -->
|
38 |
| - <div v-for="(val, key) in objUnion"> |
| 29 | + <div v-for="(val, key, index) in objUnion"> |
39 | 30 | <!-- {{ exactType(val, {} as string | number) }} -->
|
40 | 31 | {{ exactType(val, {} as string) }}
|
41 |
| - {{ isNotAnyOrUndefined(val) }} |
42 | 32 | <!-- {{ exactType(key, {} as 'a' | 'b') }} -->
|
43 | 33 | {{ exactType(key, {} as 'a') }}
|
44 |
| - {{ isNotAnyOrUndefined(key) }} |
| 34 | + {{ exactType(index, {} as number) }} |
45 | 35 | </div>
|
46 | 36 | <!-- record -->
|
47 |
| - <div v-for="(val, key) in record"> |
| 37 | + <div v-for="(val, key, index) in record"> |
48 | 38 | {{ exactType(val, {} as string) }}
|
49 |
| - {{ isNotAnyOrUndefined(val) }} |
50 | 39 | {{ exactType(key, {} as string) }}
|
51 |
| - {{ isNotAnyOrUndefined(key) }} |
| 40 | + {{ exactType(index, {} as number) }} |
52 | 41 | </div>
|
53 | 42 | <!-- any -->
|
54 |
| - <div v-for="(val, key) in _any"> |
| 43 | + <div v-for="(val, index) in _any"> |
55 | 44 | {{ exactType(val, {} as any) }}
|
56 |
| - {{ exactType(key, {} as number) }} |
57 |
| - {{ isNotAnyOrUndefined(key) }} |
| 45 | + {{ exactType(index, {} as number) }} |
58 | 46 | </div>
|
59 | 47 | </template>
|
60 | 48 |
|
61 | 49 | <script setup lang="ts">
|
62 |
| -import { exactType, isNotAnyOrUndefined } from '../../shared'; |
| 50 | +import { exactType } from '../../shared'; |
63 | 51 |
|
64 | 52 | const arr = ['a', 'b'] as const;
|
65 | 53 | const map = new Map<string, number>();
|
|
0 commit comments