Repository: facebook/jest
File: packages/jest-reporters/src/CoverageReporter.ts (TypeScript)

Code before:

      const transformedCoverage = await Promise.all(
        mergedCoverages.result.map(async res => {
          const fileTransform = fileTransforms.get(res.url);

          let sourcemapContent: EncodedSourceMap | undefined = undefined;

          if (
            fileTransform?.sourceMapPath &&
            fs.existsSync(fileTransform.sourceMapPath)
          ) {
            sourcemapContent = JSON.parse(
              fs.readFileSync(fileTransform.sourceMapPath, 'utf8'),
            );
          }

          const converter = v8toIstanbul(
            res.url,
            fileTransform?.wrapperLength ?? 0,
            fileTransform && sourcemapContent
              ? {
                  originalSource: fileTransform.originalCode,
                  source: fileTransform.code,
                  sourceMap: {
                    sourcemap: {file: res.url, ...sourcemapContent} as any,
                  },
                }
              : {source: fs.readFileSync(res.url, 'utf8')},
          );

          await converter.load();

          converter.applyCoverage(res.functions);

          const istanbulData = converter.toIstanbul();

          converter.destroy();

          return istanbulData;
        }),
      );

      const map = istanbulCoverage.createCoverageMap({});

      transformedCoverage.forEach(res => map.merge(res));

      const reportContext = istanbulReport.createContext({
        coverageMap: map,
        dir: this._globalConfig.coverageDirectory,
        watermarks: getWatermarks(this._globalConfig),
      });

Review comment (suggestion):
```suggestion
                    // remove `as any` after https://github.com/istanbuljs/v8-to-istanbul/pull/186 is released
                    sourcemap: {file: res.url, ...sourcemapContent} as any,
```

Code after:

      const transformedCoverage = await Promise.all(
        mergedCoverages.result.map(async res => {
          const fileTransform = fileTransforms.get(res.url);

          let sourcemapContent: EncodedSourceMap | undefined = undefined;

          if (
            fileTransform?.sourceMapPath &&
            fs.existsSync(fileTransform.sourceMapPath)
          ) {
            sourcemapContent = JSON.parse(
              fs.readFileSync(fileTransform.sourceMapPath, 'utf8'),
            );
          }

          const converter = v8toIstanbul(
            res.url,
            fileTransform?.wrapperLength ?? 0,
            fileTransform && sourcemapContent
              ? {
                  originalSource: fileTransform.originalCode,
                  source: fileTransform.code,
                  sourceMap: {
                    // remove `as any` after https://github.com/istanbuljs/v8-to-istanbul/pull/186 is released
                    sourcemap: {file: res.url, ...sourcemapContent} as any,
                  },
                }
              : {source: fs.readFileSync(res.url, 'utf8')},
          );

          await converter.load();

          converter.applyCoverage(res.functions);

          const istanbulData = converter.toIstanbul();

          converter.destroy();

          return istanbulData;
        }),
      );

      const map = istanbulCoverage.createCoverageMap({});

      transformedCoverage.forEach(res => map.merge(res));

      const reportContext = istanbulReport.createContext({
        coverageMap: map,
        dir: this._globalConfig.coverageDirectory,
        watermarks: getWatermarks(this._globalConfig),