From 9ace0a9991da8bcb0f04a2e603f7601d6fb630e7 Mon Sep 17 00:00:00 2001 From: Ahn <27772165+ahnpnl@users.noreply.github.com> Date: Sat, 11 Dec 2021 19:39:44 +0100 Subject: [PATCH] fix: stimulate `esbuild` type to avoid importing `esbuild` directly (#3147) --- src/types.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/types.ts b/src/types.ts index e2a7ba28d9..3c4d3ee04f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,6 @@ import type { Transformer, TransformOptions } from '@jest/transform' import type { Config } from '@jest/types' import type * as _babel from 'babel__core' -import type * as _esbuild from 'esbuild' import type * as _ts from 'typescript' import type { ConfigSet } from './config' @@ -27,7 +26,13 @@ declare module '@jest/types' { */ export type TBabelCore = typeof _babel export type TTypeScript = typeof _ts -export type TEsBuild = typeof _esbuild +// Stimulate `esbuild` type to avoid import `esbuild` while building the assets which are shipped to npm +export interface TEsBuild { + transformSync( + input: string, + options?: { loader: 'ts' | 'js'; format: 'cjs' | 'esm'; target: string }, + ): { code: string; map: string } +} /** * @internal */