mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #12102 from ineiti/add_types_annotations
Add types annotations
This commit is contained in:
commit
00a8b42e67
12 changed files with 344 additions and 139 deletions
20
test/types/main.ts
Normal file
20
test/types/main.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { getDocument } from "pdfjs-dist";
|
||||
|
||||
class MainTest {
|
||||
task: ReturnType<typeof getDocument> | undefined;
|
||||
|
||||
constructor(public file: string) {
|
||||
}
|
||||
|
||||
loadPdf() {
|
||||
this.task = getDocument("file://" + this.file);
|
||||
return this.task.promise;
|
||||
}
|
||||
}
|
||||
|
||||
// This is actually never called, as the test only consists in compiling the file.
|
||||
// The compilation will crawl through all files and make sure that the types are consistent.
|
||||
const mt = new MainTest("../pdfs/basicapi.pdf");
|
||||
mt.loadPdf().then(() => {
|
||||
console.log("loaded");
|
||||
});
|
26
test/types/tsconfig.json
Normal file
26
test/types/tsconfig.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../../build/tmp",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es5",
|
||||
"module": "es2015",
|
||||
"baseUrl": "./",
|
||||
"strict": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"paths": {
|
||||
"pdfjs-dist": ["../../build/typestest"],
|
||||
"pdfjs-dist/*": ["../../build/typestest/build/*"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
],
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue