DefinitelyTyped/types/pdfmake
Jean-Raphaël Matte 4e2b7278ed
[@types/pdfmake] Overhaul type definitions (cont. from #42787) (#42991)
* [@types/pdfmake] Split definitions

pdfmake/index.d.ts will only export the node api.
pdfmake/interfaces.d.ts will contain all data types
pdfmake/build/pdfmake.d.ts will export the browser module api as well as the global namespace object
pdfmake/build/vfs_fonts.d.ts will export the vfs for the browser

* [@types/pdfmake] Add type references for node and pdfkit

* [@types/pdfmake] Remove enums

TypeScript enums exist at runtime and should never be used in type declaration files unless they perfectly describe the behaviour of the JS code (which is highly unlikely). pdfMake only expects string literals, so the enums were modeled as unions of string literals.

* [@types/pdfmake] Overhaul interfaces

All changes were meticulously verified against the official docs, the examples AND the source code. Since the documentation is incomplete, the only real spec I had to work with was the actual implementation, which is less than ideal.

* [@types/pdfmake] Update server and browser api files

The server api exposes a class as single export object. This means the `export =` syntax is necessary for the type definitions, and the consumers must import the module with an `import PdfPrinter = require('pdfmake')` statement.
The browser api expose both a compliant ES6 module and a global 'pdfMake' object, which is why the 'export as namespace' syntax is necessary.

* [@types/pdfmake] Update tests

The examples provided by the pdfMake playground and repository are all copied in pdfmake-playground-examples-tests.ts and pdfmake-examples-test.ts respectively.
The pdfmake-interfaces-tests.ts contains code from the documentation as well as additionnal tests for coverage.
The other files test all different flavors of the api.

* [@types/pdfmake] Add myself as maintainer

* [@types/pdfmake] Layout long union type

* [@types/pdfmake] Add PageBreak union type

* [@types/pdfmake] Add doc comments

* [@types/pdfmake] Fix typo
2020-03-30 17:42:10 -07:00
..
build
test
index.d.ts
interfaces.d.ts
tsconfig.json
tslint.json