-
-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
479 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
packages/vue-test-workspace/vue-tsc-dts/components/script-setup-default-props.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
export interface Props { | ||
msg?: string | ||
labels?: string[] | ||
} | ||
withDefaults(defineProps<Props>(), { | ||
msg: 'hello', | ||
labels: () => ['one', 'two'] | ||
}) | ||
</script> |
11 changes: 11 additions & 0 deletions
11
packages/vue-test-workspace/vue-tsc-dts/components/script-setup-expose.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const a = 1; | ||
const b = ref(2); | ||
defineExpose({ | ||
a, | ||
b | ||
}); | ||
</script> |
10 changes: 10 additions & 0 deletions
10
packages/vue-test-workspace/vue-tsc-dts/components/script-setup-generic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup lang="ts" generic="T"> | ||
defineProps<{ foo: T }>(); | ||
defineEmits<{ (e: 'bar', data: T): void }>(); | ||
defineExpose({ baz: {} as T }); | ||
defineSlots<{ default?(data: T): any }>(); | ||
</script> | ||
|
||
<script lang="ts"> | ||
declare function defineSlots<T>(): T; | ||
</script> |
11 changes: 11 additions & 0 deletions
11
packages/vue-test-workspace/vue-tsc-dts/components/script-setup-type-only.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
foo: string | ||
bar?: number | ||
}>() | ||
defineEmits<{ | ||
(e: 'change', id: number): void | ||
(e: 'update', value: string): void | ||
}>() | ||
</script> |
7 changes: 7 additions & 0 deletions
7
packages/vue-test-workspace/vue-tsc-dts/components/script-setup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"> | ||
defineProps({ | ||
foo: String | ||
}) | ||
defineEmits(['change', 'delete']) | ||
</script> |
3 changes: 3 additions & 0 deletions
3
packages/vue-test-workspace/vue-tsc-dts/defineEmits-new-syntax/main.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script setup lang="ts"> | ||
defineEmits<{ foo: [string]; }>(); | ||
</script> |
5 changes: 5 additions & 0 deletions
5
packages/vue-test-workspace/vue-tsc-dts/defineExpose/main.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script setup lang="ts"> | ||
const foo = 123; | ||
defineExpose({ foo }); | ||
</script> |
11 changes: 11 additions & 0 deletions
11
packages/vue-test-workspace/vue-tsc-dts/defineModel/main.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
// @ts-nocheck wait for 3.3 added defineModel | ||
import { exactType } from '../../shared'; | ||
const a = defineModel<string>(); // modelValue | ||
const c = defineModel<number>('c', { required: true }); | ||
const d = defineModel<number>('d', { required: false }); | ||
const e = defineModel<string>('e'); | ||
const f = defineModel<string>('f', { required: true }); | ||
const g = defineModel<string>('g', { required: false }); | ||
</script> |
20 changes: 20 additions & 0 deletions
20
packages/vue-test-workspace/vue-tsc-dts/defineProp_A/main.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup lang="ts"> | ||
// @experimentalDefinePropProposal=kevinEdition | ||
interface Qux { qux: true; }; | ||
defineProp<string>('foo'); | ||
defineProp<string>('bar', { | ||
type: String, | ||
required: true, | ||
default: 'bar', | ||
}); | ||
defineProp<string | number>('baz', { | ||
required: true, | ||
default: () => [1, 2, 3], | ||
}); | ||
defineProp<Qux>('qux'); | ||
defineProp<boolean>('quux', { default: true }); | ||
// infer prop name from variable name | ||
const quuz = defineProp(); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
packages/vue-test-workspace/vue-tsc-dts/defineProp_B/script-setup-generic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script setup lang="ts" generic="T"> | ||
// @experimentalDefinePropProposal=johnsonEdition | ||
const a = defineProp<T>(); | ||
const b = defineProp<T>(undefined); | ||
const c = defineProp<T>(undefined, false); | ||
const d = defineProp<T>(undefined, true); | ||
</script> |
11 changes: 11 additions & 0 deletions
11
packages/vue-test-workspace/vue-tsc-dts/defineProp_B/script-setup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
// @experimentalDefinePropProposal=johnsonEdition | ||
const a = defineProp<string>(); | ||
const b = defineProp('', true); | ||
const c = defineProp(1, true); | ||
const d = defineProp(1, false); | ||
const e = defineProp<string>(undefined); | ||
const f = defineProp<string>(undefined, true); | ||
const g = defineProp<string>(undefined, false); | ||
</script> |
5 changes: 5 additions & 0 deletions
5
packages/vue-test-workspace/vue-tsc-dts/events/union_type.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script setup lang="ts"> | ||
defineEmits<{ | ||
(e: "a" | "b", a: string): void; | ||
}>(); | ||
</script> |
6 changes: 6 additions & 0 deletions
6
packages/vue-test-workspace/vue-tsc-dts/generic-interface/main.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<script setup lang="ts" generic="T"> | ||
interface Props { | ||
foo: T; | ||
} | ||
defineProps<Props>(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<!-- template slots type --> | ||
<slot name="bar" str="str" :num="1"></slot> | ||
|
||
<!-- typed slot key --> | ||
<slot :name="baz" str="str" :num="1"></slot> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { ref } from 'vue'; | ||
const baz = ref('baz' as const); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.