wip: useOptions -> defineOptions

This commit is contained in:
Evan You
2020-11-13 17:38:28 -05:00
parent 91d990d45a
commit 1ff5960971
6 changed files with 123 additions and 124 deletions

View File

@@ -56,7 +56,25 @@ return { color }
}"
`;
exports[`SFC compile <script setup> errors should allow useOptions() referencing imported binding 1`] = `
exports[`SFC compile <script setup> defineOptions() 1`] = `
"export default {
props: {
foo: String
},
emit: ['a', 'b'],
setup(__props, { props, emit }) {
const bar = 1
return { props, emit, bar }
}
}"
`;
exports[`SFC compile <script setup> errors should allow defineOptions() referencing imported binding 1`] = `
"import { bar } from './bar'
export default {
@@ -75,7 +93,7 @@ return { bar }
}"
`;
exports[`SFC compile <script setup> errors should allow useOptions() referencing scope var 1`] = `
exports[`SFC compile <script setup> errors should allow defineOptions() referencing scope var 1`] = `
"export default {
props: {
foo: {
@@ -375,40 +393,7 @@ return { a, b, c, d, x }
}"
`;
exports[`SFC compile <script setup> useOptions() 1`] = `
"export default {
props: {
foo: String
},
emit: ['a', 'b'],
setup(__props, { props, emit }) {
const bar = 1
return { props, emit, bar }
}
}"
`;
exports[`SFC compile <script setup> with TypeScript hoist type declarations 1`] = `
"import { defineComponent } from 'vue'
export interface Foo {}
type Bar = {}
export default defineComponent({
setup() {
return { }
}
})"
`;
exports[`SFC compile <script setup> with TypeScript useOptions w/ runtime options 1`] = `
exports[`SFC compile <script setup> with TypeScript defineOptions w/ runtime options 1`] = `
"import { defineComponent } from 'vue'
@@ -425,7 +410,7 @@ return { props, emit }
})"
`;
exports[`SFC compile <script setup> with TypeScript useOptions w/ type / extract emits (union) 1`] = `
exports[`SFC compile <script setup> with TypeScript defineOptions w/ type / extract emits (union) 1`] = `
"import { Slots, defineComponent } from 'vue'
@@ -446,7 +431,7 @@ return { emit }
})"
`;
exports[`SFC compile <script setup> with TypeScript useOptions w/ type / extract emits 1`] = `
exports[`SFC compile <script setup> with TypeScript defineOptions w/ type / extract emits 1`] = `
"import { Slots, defineComponent } from 'vue'
@@ -467,7 +452,7 @@ return { emit }
})"
`;
exports[`SFC compile <script setup> with TypeScript useOptions w/ type / extract props 1`] = `
exports[`SFC compile <script setup> with TypeScript defineOptions w/ type / extract props 1`] = `
"import { defineComponent } from 'vue'
interface Test {}
@@ -503,6 +488,21 @@ export default defineComponent({
return { }
}
})"
`;
exports[`SFC compile <script setup> with TypeScript hoist type declarations 1`] = `
"import { defineComponent } from 'vue'
export interface Foo {}
type Bar = {}
export default defineComponent({
setup() {
return { }
}