Update typescript

This commit is contained in:
Johannes Zillmann 2024-03-19 16:50:58 -06:00
parent e56d70c599
commit c696806a0e
4 changed files with 3369 additions and 7294 deletions

10643
core/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,16 +32,16 @@
"postversion": "git push && git push --tags"
},
"devDependencies": {
"@types/jest": "^26.0.19",
"jest": "^26.6.3",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"jest-file-snapshot": "^0.5.0",
"patch-package": "^6.4.7",
"pdfjs-dist": "^2.5.207",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"ts-jest": "^29.1.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.1.3"
"typescript": "^5.4.2"
},
"dependencies": {
"@types/string-similarity": "^4.0.0",

View File

@ -17,6 +17,9 @@ import EvaluationIndex from 'src/debug/EvaluationIndex';
import { Change } from 'src/debug/ChangeIndex';
import DetectToc, { TOC_GLOBAL } from 'src/transformer/DetectToc';
import Globals from 'src/Globals';
import TOC from 'src/TOC';
import { getText } from 'src/support/items';
pdfjs.GlobalWorkerOptions.workerSrc = `pdfjs-dist/es5/build/pdf.worker.min.js`;
const parser = new PdfParser(pdfjs);
@ -148,7 +151,7 @@ function globalsToString(globals: Globals, alreadyPrintedGlobals: Set<string>):
.filter(([key, value]) => !alreadyPrintedGlobals.has(key))
.reduce((obj, [key, value]) => {
if (key === TOC_GLOBAL.key) {
const toc = value as TOC;
const toc: TOC = value;
value = {
...toc,
tocHeadlineItems: toc.tocHeadlineItems.map((item) => ({
@ -172,7 +175,7 @@ function itemToString(
let newFontName: string | Array<string> | undefined = undefined;
if (fontName) {
if (typeof fontName === 'string') {
newFontName = fontMap.get(fontName)?.['name'] as string;
newFontName = fontMap.get(fontName)?.['name'];
} else {
newFontName = fontName.map((name) => fontMap.get(name)?.['name']);
}
@ -234,7 +237,9 @@ function downloadToFile(url: string, dest: string): Promise<void> {
.pipe(file);
} else if (res.statusCode === 302 || res.statusCode === 301) {
// Recursively follow redirects, only a 200 will resolve.
downloadToFile(res.headers.location as string, dest).then(() => resolve());
if (res.headers.location) {
downloadToFile(res.headers.location, dest).then(() => resolve());
}
} else {
reject(new Error(`Download request failed, response status: ${res.statusCode} ${res.statusMessage}`));
}

View File

@ -7,6 +7,7 @@
"strict": true,
"noImplicitAny": false,
"noUnusedLocals": false,
"useUnknownInCatchVariables": false,
"baseUrl": "./",
"paths": {
"src/*": ["src/*"],