fix(compiler-vapor): TS error

This commit is contained in:
三咲智子 Kevin Deng 2024-04-18 14:54:33 +08:00
parent 98b701c82c
commit 1af1f40247
No known key found for this signature in database
3 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import type {
CodegenOptions as BaseCodegenOptions,
BaseCodegenResult,
CodegenSourceMapGenerator,
} from '@vue/compiler-dom'
import type { IREffect, RootIRNode, VaporHelper } from './ir'
import { SourceMapGenerator } from 'source-map-js'
@ -24,7 +25,7 @@ export class CodegenContext {
options: Required<CodegenOptions>
code: CodeFragment[]
map?: SourceMapGenerator
map?: CodegenSourceMapGenerator
push: (...args: CodeFragment[]) => void
helpers = new Set<string>([])
@ -93,7 +94,8 @@ export class CodegenContext {
} = this
if (!__BROWSER__ && sourceMap) {
// lazy require source-map implementation, only in non-browser builds
this.map = new SourceMapGenerator()
this.map =
new SourceMapGenerator() as unknown as CodegenSourceMapGenerator
this.map.setSourceContent(filename, ir.source)
this.map._sources.add(filename)
}

View File

@ -148,7 +148,6 @@ export function genCodeFragment(context: CodegenContext) {
generatedLine: pos.line,
generatedColumn: pos.column - 1,
source: context.options.filename,
// @ts-expect-error it is possible to be null
name,
})
}

View File

@ -413,7 +413,6 @@ async function isInSyncWithRemote() {
console.error(
pico.red('Failed to check whether local HEAD is up-to-date with remote.'),
)
console.error(e)
return false
}
}