feat(sfc): support using declared interface or type alias with defineProps()
This commit is contained in:
@@ -780,6 +780,63 @@ return { emit }
|
||||
})"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> with TypeScript defineProps w/ exported interface 1`] = `
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
export interface Props { x?: number }
|
||||
|
||||
export default _defineComponent({
|
||||
props: {
|
||||
x: { type: Number, required: false }
|
||||
} as unknown as undefined,
|
||||
setup(__props: { x?: number }, { expose }) {
|
||||
expose()
|
||||
|
||||
|
||||
|
||||
return { }
|
||||
}
|
||||
|
||||
})"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> with TypeScript defineProps w/ exported type alias 1`] = `
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
export type Props = { x?: number }
|
||||
|
||||
export default _defineComponent({
|
||||
props: {
|
||||
x: { type: Number, required: false }
|
||||
} as unknown as undefined,
|
||||
setup(__props: { x?: number }, { expose }) {
|
||||
expose()
|
||||
|
||||
|
||||
|
||||
return { }
|
||||
}
|
||||
|
||||
})"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> with TypeScript defineProps w/ interface 1`] = `
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
interface Props { x?: number }
|
||||
|
||||
export default _defineComponent({
|
||||
props: {
|
||||
x: { type: Number, required: false }
|
||||
} as unknown as undefined,
|
||||
setup(__props: { x?: number }, { expose }) {
|
||||
expose()
|
||||
|
||||
|
||||
|
||||
return { }
|
||||
}
|
||||
|
||||
})"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> with TypeScript defineProps w/ type 1`] = `
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
|
||||
@@ -840,6 +897,25 @@ export default _defineComponent({
|
||||
|
||||
|
||||
|
||||
return { }
|
||||
}
|
||||
|
||||
})"
|
||||
`;
|
||||
|
||||
exports[`SFC compile <script setup> with TypeScript defineProps w/ type alias 1`] = `
|
||||
"import { defineComponent as _defineComponent } from 'vue'
|
||||
type Props = { x?: number }
|
||||
|
||||
export default _defineComponent({
|
||||
props: {
|
||||
x: { type: Number, required: false }
|
||||
} as unknown as undefined,
|
||||
setup(__props: { x?: number }, { expose }) {
|
||||
expose()
|
||||
|
||||
|
||||
|
||||
return { }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user