fix(types): update setup binding unwrap types for 6b10f0c

close #738
This commit is contained in:
Evan You
2020-02-19 18:29:01 +01:00
parent 8d817bb446
commit a840e7ddf0
2 changed files with 35 additions and 9 deletions

View File

@@ -1,5 +1,13 @@
import { expectError, expectType } from 'tsd'
import { describe, defineComponent, PropType, ref, createApp } from './index'
import {
describe,
defineComponent,
PropType,
ref,
Ref,
reactive,
createApp
} from './index'
describe('with object props', () => {
interface ExpectedProps {
@@ -57,11 +65,14 @@ describe('with object props', () => {
// setup context
return {
c: ref(1),
d: {
d: reactive({
e: ref('hi')
},
f: {
}),
f: reactive({
g: ref('hello' as GT)
}),
h: {
i: ref('hi')
}
}
},
@@ -95,6 +106,9 @@ describe('with object props', () => {
expectType<string>(this.d.e)
expectType<GT>(this.f.g)
// should not unwrap refs nested under non-reactive objects
expectType<Ref<string>>(this.h.i)
// setup context properties should be mutable
this.c = 2