mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #63772 [markdown-pdf]: Fix the type for to.buffer callback by @priyankark
* Fix markdown-pdf to.buffer type * Update test * Prettier Fixes * Fix tests after prettier formatting changes
This commit is contained in:
6
types/markdown-pdf/index.d.ts
vendored
6
types/markdown-pdf/index.d.ts
vendored
@@ -35,8 +35,8 @@ declare namespace MarkdownPDF {
|
||||
/** A config object that is passed to remarkable, the underlying markdown parser */
|
||||
remarkable?: any; // FIXME: remarkable config types
|
||||
}
|
||||
type PaperFormat = "A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid";
|
||||
type PaperOrientation = "portait" | "landscape";
|
||||
type PaperFormat = 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid';
|
||||
type PaperOrientation = 'portait' | 'landscape';
|
||||
|
||||
interface OptionsBuilder {
|
||||
/** Create a readable stream and pipe it to markdown pdf. */
|
||||
@@ -77,7 +77,7 @@ declare namespace MarkdownPDF {
|
||||
*/
|
||||
path(path: string, callback?: () => void): void;
|
||||
/** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the buffer has been created. */
|
||||
buffer(opts: any, callback?: () => void): void;
|
||||
buffer(opts: any, callback?: (err: any, buffer: ArrayBuffer) => void): void;
|
||||
/** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the string has been created. */
|
||||
string(opts: any, callback?: () => void): void;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,38 @@
|
||||
import mdPdf = require('markdown-pdf');
|
||||
|
||||
mdPdf().from('path').to('path', () => { }); // $ExpectType void
|
||||
mdPdf().from.string('markdown').to('path', () => { }); // $ExpectType void
|
||||
mdPdf({ paperOrientation: 'landscape', paperFormat: 'A3' }).from('lol').to('lol', () => { }); // $ExpectType void
|
||||
mdPdf().concat.from.paths(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void
|
||||
mdPdf().concat.from.strings(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void
|
||||
mdPdf().from('path').to.path('path', () => { }); // $ExpectType void
|
||||
mdPdf().from('path').to('path'); // $ExpectType void
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.from('path')
|
||||
.to('path', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.from.string('markdown')
|
||||
.to('path', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf({ paperOrientation: 'landscape', paperFormat: 'A3' })
|
||||
.from('lol')
|
||||
.to('lol', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.concat.from.paths(['lol', 'lol'], {})
|
||||
.to('path', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.concat.from.strings(['lol', 'lol'], {})
|
||||
.to('path', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.from('path')
|
||||
.to.path('path', () => {});
|
||||
// $ExpectType void
|
||||
mdPdf().from('path').to('path');
|
||||
|
||||
// $ExpectType void
|
||||
mdPdf()
|
||||
.from.string('markdown')
|
||||
.to.buffer(null, (err, buffer) => {
|
||||
buffer; // $ExpectType ArrayBuffer
|
||||
});
|
||||
|
||||
// @ts-expect-error
|
||||
mdPdf({ paperFormat: 'wrongFormat' });
|
||||
|
||||
Reference in New Issue
Block a user