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

@@ -1,7 +1,7 @@
import { expectType, useOptions, Slots, describe } from './index'
import { expectType, defineOptions, Slots, describe } from './index'
describe('no args', () => {
const { props, attrs, emit, slots } = useOptions()
const { props, attrs, emit, slots } = defineOptions()
expectType<{}>(props)
expectType<Record<string, unknown>>(attrs)
expectType<(...args: any[]) => void>(emit)
@@ -15,7 +15,7 @@ describe('no args', () => {
})
describe('with type arg', () => {
const { props, attrs, emit, slots } = useOptions<{
const { props, attrs, emit, slots } = defineOptions<{
props: {
foo: string
}
@@ -40,7 +40,7 @@ describe('with type arg', () => {
// with runtime arg
describe('with runtime arg (array syntax)', () => {
const { props, emit } = useOptions({
const { props, emit } = defineOptions({
props: ['foo', 'bar'],
emits: ['foo', 'bar']
})
@@ -59,7 +59,7 @@ describe('with runtime arg (array syntax)', () => {
})
describe('with runtime arg (object syntax)', () => {
const { props, emit } = useOptions({
const { props, emit } = defineOptions({
props: {
foo: String,
bar: {