From a1f6ac9c00951951f363cb9e6c42ed0f1cc7ee24 Mon Sep 17 00:00:00 2001 From: webfansplz <308241863@qq.com> Date: Fri, 23 Jul 2021 01:04:41 +0800 Subject: [PATCH] chore(types): remove unnecessary type assertions (#4356) --- packages/vite/src/node/server/index.ts | 2 +- packages/vite/src/node/ssr/ssrStacktrace.ts | 2 +- packages/vite/src/node/ssr/ssrTransform.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/server/index.ts b/packages/vite/src/node/server/index.ts index 72bad509077675..d380d0029b1a9c 100644 --- a/packages/vite/src/node/server/index.ts +++ b/packages/vite/src/node/server/index.ts @@ -352,7 +352,7 @@ export async function createServer( transformRequest(url, options) { return transformRequest(url, server, options) }, - transformIndexHtml: null as any, + transformIndexHtml: null!, // to be immediately set ssrLoadModule(url) { if (!server._ssrExternals) { server._ssrExternals = resolveSSRExternal( diff --git a/packages/vite/src/node/ssr/ssrStacktrace.ts b/packages/vite/src/node/ssr/ssrStacktrace.ts index 4dda7eb9eb175d..23fd7d018f0185 100644 --- a/packages/vite/src/node/ssr/ssrStacktrace.ts +++ b/packages/vite/src/node/ssr/ssrStacktrace.ts @@ -32,7 +32,7 @@ export function ssrRewriteStacktrace( } const consumer = new SourceMapConsumer( - rawSourceMap as any as RawSourceMap + rawSourceMap as unknown as RawSourceMap ) const pos = consumer.originalPositionFor({ diff --git a/packages/vite/src/node/ssr/ssrTransform.ts b/packages/vite/src/node/ssr/ssrTransform.ts index c0b085b0b2f3d0..45d0a95b16d0dd 100644 --- a/packages/vite/src/node/ssr/ssrTransform.ts +++ b/packages/vite/src/node/ssr/ssrTransform.ts @@ -146,9 +146,9 @@ export async function ssrTransform( // export * from './foo' if (node.type === 'ExportAllDeclaration') { - if ((node as any).exported) { + if (node.exported) { const importId = defineImport(node, node.source.value as string) - defineExport((node as any).exported.name, `${importId}`) + defineExport(node.exported.name, `${importId}`) s.remove(node.start, node.end) } else { const importId = defineImport(node, node.source.value as string)