Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TypeScript to version 4.6.2 and work-around stricter type checks #14640

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"terser": "^5.12.0",
"through2": "^4.0.2",
"ttest": "^3.0.0",
"typescript": "^4.5.5",
"typescript": "^4.6.2",
"typogr": "^0.6.8",
"vinyl": "^2.2.1",
"vinyl-fs": "^3.0.3",
Expand Down
8 changes: 4 additions & 4 deletions src/display/base_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class BaseCanvasFactory {
}

/**
* @private
* @ignore
*/
_createCanvas(width, height) {
unreachable("Abstract method `_createCanvas` called.");
Expand Down Expand Up @@ -96,7 +96,7 @@ class BaseCMapReaderFactory {
}

/**
* @private
* @ignore
*/
_fetchData(url, compressionType) {
unreachable("Abstract method `_fetchData` called.");
Expand Down Expand Up @@ -129,7 +129,7 @@ class BaseStandardFontDataFactory {
}

/**
* @private
* @ignore
*/
_fetchData(url) {
unreachable("Abstract method `_fetchData` called.");
Expand Down Expand Up @@ -165,7 +165,7 @@ class BaseSVGFactory {
}

/**
* @private
* @ignore
*/
_createSVG(type) {
unreachable("Abstract method `_createSVG` called.");
Expand Down
12 changes: 12 additions & 0 deletions src/display/display_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class DOMCanvasFactory extends BaseCanvasFactory {
this._document = ownerDocument;
}

/**
* @ignore
*/
_createCanvas(width, height) {
const canvas = this._document.createElement("canvas");
canvas.width = width;
Expand Down Expand Up @@ -91,6 +94,9 @@ async function fetchData(url, asTypedArray = false) {
}

class DOMCMapReaderFactory extends BaseCMapReaderFactory {
/**
* @ignore
*/
_fetchData(url, compressionType) {
return fetchData(url, /* asTypedArray = */ this.isCompressed).then(data => {
return { cMapData: data, compressionType };
Expand All @@ -99,12 +105,18 @@ class DOMCMapReaderFactory extends BaseCMapReaderFactory {
}

class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
/**
* @ignore
*/
_fetchData(url) {
return fetchData(url, /* asTypedArray = */ true);
}
}

class DOMSVGFactory extends BaseSVGFactory {
/**
* @ignore
*/
_createSVG(type) {
return document.createElementNS(SVG_NS, type);
}
Expand Down
9 changes: 9 additions & 0 deletions src/display/node_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ if ((typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && isNodeJS) {
};

NodeCanvasFactory = class extends BaseCanvasFactory {
/**
* @ignore
*/
_createCanvas(width, height) {
const Canvas = __non_webpack_require__("canvas");
return Canvas.createCanvas(width, height);
}
};

NodeCMapReaderFactory = class extends BaseCMapReaderFactory {
/**
* @ignore
*/
_fetchData(url, compressionType) {
return fetchData(url).then(data => {
return { cMapData: data, compressionType };
Expand All @@ -70,6 +76,9 @@ if ((typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && isNodeJS) {
};

NodeStandardFontDataFactory = class extends BaseStandardFontDataFactory {
/**
* @ignore
*/
_fetchData(url) {
return fetchData(url);
}
Expand Down