From: edison Date: Mon, 17 Feb 2025 07:07:10 +0000 (+0800) Subject: chore(deps): fix MappingItem type (#12891) X-Git-Tag: v3.5.14~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbf5821028485befc11f9927b27e5b03d484cf9d;p=thirdparty%2Fvuejs%2Fcore.git chore(deps): fix MappingItem type (#12891) --- diff --git a/packages/compiler-sfc/__tests__/parse.spec.ts b/packages/compiler-sfc/__tests__/parse.spec.ts index 87cd05ed0e..265655e47e 100644 --- a/packages/compiler-sfc/__tests__/parse.spec.ts +++ b/packages/compiler-sfc/__tests__/parse.spec.ts @@ -81,7 +81,7 @@ font-weight: bold; const consumer = new SourceMapConsumer(script!.map!) consumer.eachMapping(mapping => { - expect(mapping.originalLine - mapping.generatedLine).toBe(padding) + expect(mapping.originalLine! - mapping.generatedLine).toBe(padding) }) }) @@ -100,8 +100,8 @@ font-weight: bold; const consumer = new SourceMapConsumer(template.map!) consumer.eachMapping(mapping => { - expect(mapping.originalLine - mapping.generatedLine).toBe(padding) - expect(mapping.originalColumn - mapping.generatedColumn).toBe(2) + expect(mapping.originalLine! - mapping.generatedLine).toBe(padding) + expect(mapping.originalColumn! - mapping.generatedColumn).toBe(2) }) }) @@ -115,7 +115,7 @@ font-weight: bold; const consumer = new SourceMapConsumer(custom!.map!) consumer.eachMapping(mapping => { - expect(mapping.originalLine - mapping.generatedLine).toBe(padding) + expect(mapping.originalLine! - mapping.generatedLine).toBe(padding) }) }) }) diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts index 322b1570e1..b043cf813d 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -289,7 +289,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap { const origPosInOldMap = oldMapConsumer.originalPositionFor({ line: m.originalLine, - column: m.originalColumn, + column: m.originalColumn!, }) if (origPosInOldMap.source == null) { @@ -305,7 +305,7 @@ function mapLines(oldMap: RawSourceMap, newMap: RawSourceMap): RawSourceMap { line: origPosInOldMap.line, // map line // use current column, since the oldMap produced by @vue/compiler-sfc // does not - column: m.originalColumn, + column: m.originalColumn!, }, source: origPosInOldMap.source, name: origPosInOldMap.name,