From 22ea7757d441143c5efcc8a1a84fe55933bbc033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Exbrayat?= Date: Fri, 27 May 2022 09:04:12 +0200 Subject: [PATCH] chore: add return type to createStub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the error: ``` src/index.ts → dist/vue-test-utils.esm-bundler.mjs... [!] (plugin commonjs--resolver) Error: /home/runner/work/test-utils/test-utils/src/stubs.ts(77,14): semantic error TS2742: The inferred type of 'createStub' cannot be named without a reference to '@vue/compiler-dom/node_modules/@vue/shared'. This is likely not portable. A type annotation is necessary. ``` that we see when upgrading the lockfile in #1543 --- src/stubs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stubs.ts b/src/stubs.ts index cf3977815..3c04b3509 100644 --- a/src/stubs.ts +++ b/src/stubs.ts @@ -9,7 +9,8 @@ import { VNodeTypes, ConcreteComponent, ComponentPropsOptions, - ComponentObjectPropsOptions + ComponentObjectPropsOptions, + DefineComponent } from 'vue' import { hyphenate } from './utils/vueShared' import { matchName } from './utils/matchName' @@ -78,7 +79,7 @@ export const createStub = ({ name, type, renderStubDefaultSlot -}: StubOptions) => { +}: StubOptions): DefineComponent => { const anonName = 'anonymous-stub' const tag = name ? `${hyphenate(name)}-stub` : anonName