Skip to content

Commit 248aa41

Browse files
committed
Add tests for vuejs#3779, vuejs#3820
1 parent e4d3683 commit 248aa41

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script setup lang="ts">
2+
import { exactType } from '../../shared';
3+
defineProps<{
4+
optionalBoolean?: boolean;
5+
}>();
6+
</script>
7+
8+
<template>
9+
<h1>{{ exactType(optionalBoolean, {} as boolean | undefined) }}</h1>
10+
</template>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script setup lang="ts">
2+
import { exactType } from '../../shared';
3+
const props = defineProps<{
4+
optionalBoolean?: boolean;
5+
}>();
6+
</script>
7+
8+
<template>
9+
<h1>{{ exactType(optionalBoolean, true as boolean) }}</h1>
10+
</template>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script setup lang="ts" generic="T extends { name: string }">
2+
const props = defineProps<{
3+
one: T;
4+
all: Array<T>;
5+
}>();
6+
</script>
7+
8+
<template>
9+
<div>
10+
<!-- incorrect inference -->
11+
<div>{{ one.name }}</div>
12+
<!-- correct inference -->
13+
<div>{{ props.one.name }}</div>
14+
<ul>
15+
<!-- correct inference -->
16+
<li v-for="el in all">{{ el.name }}</li>
17+
</ul>
18+
</div>
19+
</template>

0 commit comments

Comments
 (0)