mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #65516 Add types for epub-gen by @styler3
* Add types for epub-gen * Fix typo * Add undefined for optional types * Correct CommonJS export * Combine class with namespace
This commit is contained in:
4
types/epub-gen/epub-gen-tests.ts
Normal file
4
types/epub-gen/epub-gen-tests.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import Epub = require('epub-gen');
|
||||
|
||||
new Epub({ title: '', content: [] }); // $ExpectType Epub
|
||||
(new Epub({ title: '', content: [] })).promise; // $ExpectType Promise<void>
|
||||
63
types/epub-gen/index.d.ts
vendored
Normal file
63
types/epub-gen/index.d.ts
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// Type definitions for epub-gen 0.1
|
||||
// Project: https://github.com/cyrilis/epub-gen
|
||||
// Definitions by: Sam Tyler <https://github.com/styler3>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Epub {
|
||||
interface Chapter {
|
||||
/** Chapter title */
|
||||
title?: string | undefined;
|
||||
/** Author of the chapter */
|
||||
author?: string | undefined;
|
||||
/** HTML String of the chapter content. */
|
||||
data: string;
|
||||
/** Exclude the chapter from the table of contents */
|
||||
excludeFromToc?: boolean | undefined;
|
||||
/** Show the chapter before table of contents. For example, copyright pages. */
|
||||
beforeToc?: boolean | undefined;
|
||||
/** Specify filename for the chapter */
|
||||
filename?: string | undefined;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/** Title of the book */
|
||||
title: string;
|
||||
/** Name of the Author/Authors of the book */
|
||||
author?: string | string[] | undefined;
|
||||
/** Publisher name */
|
||||
publisher?: string | undefined;
|
||||
/** Book cover image. File path (absolute) or web url */
|
||||
cover?: string | undefined;
|
||||
/** Output path */
|
||||
output?: string | undefined;
|
||||
/** Epub version. If not specified, will fall back to 3. */
|
||||
version?: 2 | 3 | undefined;
|
||||
/** A CSS string to replace default style */
|
||||
css?: string | undefined;
|
||||
/** Absolute paths to font files, so that they can be used in custom CSS */
|
||||
fonts?: string[] | undefined;
|
||||
/** Language of the book in two letter code. If not specified, will fall back to `en` */
|
||||
lang?: string | undefined;
|
||||
/** Title of the table of contents. If not specified, will fallback to "Table Of Contents". */
|
||||
tocTitle?: string | undefined;
|
||||
/** Automatically append the chapter title at the beginning of each contents. */
|
||||
appendChapterTitles?: boolean | undefined;
|
||||
/** For advanced customizations: absolute path to an OPF template. */
|
||||
customOpfTemplatePath?: string | undefined;
|
||||
/** For advanced customizations: absolute path to a NCX toc template. */
|
||||
customNcxTemplatePath?: string | undefined;
|
||||
/** For advanced customizations: absolute path to a HTML toc template. */
|
||||
customHtmlTocTemplatePath?: string | undefined;
|
||||
/** Book Chapters content. */
|
||||
content: Chapter[];
|
||||
/** Whether or not to log progress messages */
|
||||
verbose?: boolean | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
declare class Epub {
|
||||
constructor(options: Epub.Options, output?: string);
|
||||
promise: Promise<void>;
|
||||
}
|
||||
|
||||
export = Epub;
|
||||
23
types/epub-gen/tsconfig.json
Normal file
23
types/epub-gen/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"epub-gen-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/epub-gen/tslint.json
Normal file
1
types/epub-gen/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user