Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/vuePublic

Commit29e09f3

Browse files
test(types): add test case
1 parent7da94ea commit29e09f3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎types/test/v3/reactivity-test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ import {
1313
markRaw,
1414
shallowReadonly,
1515
set,
16-
del
16+
del,
17+
ShallowRef
1718
}from'../../index'
18-
import{IsUnion,describe,expectType}from'../utils'
19+
import{IsUnion,describe,expectType,expectError}from'../utils'
1920

2021
functionplainType(arg:number|Ref<number>){
2122
// ref coercing
@@ -163,6 +164,15 @@ if (shallowStatus.value === 'initial') {
163164
shallowStatus.value='invalidating'
164165
}
165166

167+
{
168+
// should return ShallowRef<T> | Ref<T>, not ShallowRef<T | Ref<T>>
169+
expectType<ShallowRef<{name:string}>|Ref<{name:string}>>(
170+
shallowRef({}as{name:string}|Ref<{name:string}>)
171+
)
172+
expectType<ShallowRef<number>|Ref<string[]>|ShallowRef<string>>(
173+
shallowRef(''asRef<string[]>|string|number)
174+
)
175+
}
166176
constrefStatus=ref<Status>('initial')
167177
if(refStatus.value==='initial'){
168178
expectType<Ref<Status>>(shallowStatus)
@@ -386,7 +396,6 @@ describe('set/del', () => {
386396
del([],'fse',123)
387397
})
388398

389-
390399
{
391400
//#12978
392401
typeSteps={step:'1'}|{step:'2'}
@@ -395,4 +404,4 @@ describe('set/del', () => {
395404

396405
expectType<IsUnion<typeofshallowUnionGenParam>>(false)
397406
expectType<IsUnion<typeofshallowUnionAsCast>>(false)
398-
}
407+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp