From: Yang Mingshan Date: Fri, 5 Feb 2021 18:55:23 +0000 (+0800) Subject: types: use non-null assertion instead of explicit type cast (#2974) X-Git-Tag: v3.0.6~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01fdbf4b060f6e01507f39150b7dace81b575c18;p=thirdparty%2Fvuejs%2Fcore.git types: use non-null assertion instead of explicit type cast (#2974) --- diff --git a/packages/runtime-core/__tests__/apiInject.spec.ts b/packages/runtime-core/__tests__/apiInject.spec.ts index bb21524878..f4bf2758fb 100644 --- a/packages/runtime-core/__tests__/apiInject.spec.ts +++ b/packages/runtime-core/__tests__/apiInject.spec.ts @@ -139,7 +139,7 @@ describe('api: provide/inject', () => { const Consumer = { setup() { - const count = inject('count') as Ref + const count = inject>('count')! return () => count.value } } @@ -169,7 +169,7 @@ describe('api: provide/inject', () => { const Consumer = { setup() { - const count = inject('count') as Ref + const count = inject>('count')! // should not work count.value++ return () => count.value @@ -206,7 +206,7 @@ describe('api: provide/inject', () => { const Consumer = { setup() { - const state = inject('state') as typeof rootState + const state = inject('state')! return () => state.count } } @@ -236,7 +236,7 @@ describe('api: provide/inject', () => { const Consumer = { setup() { - const state = inject('state') as typeof rootState + const state = inject('state')! // should not work state.count++ return () => state.count