From f76d4aaa069587cf10fd2a5ff76e848abb18ec31 Mon Sep 17 00:00:00 2001 From: taoqf Date: Sat, 19 May 2018 14:26:35 +0800 Subject: [PATCH] add v1 --- types/jsreport-html-to-xlsx/v1/index.d.ts | 24 +++++++++++++++++ .../v1/jsreport-html-to-xlsx-tests.ts | 19 ++++++++++++++ types/jsreport-html-to-xlsx/v1/tsconfig.json | 26 +++++++++++++++++++ types/jsreport-html-to-xlsx/v1/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/jsreport-html-to-xlsx/v1/index.d.ts create mode 100644 types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts create mode 100644 types/jsreport-html-to-xlsx/v1/tsconfig.json create mode 100644 types/jsreport-html-to-xlsx/v1/tslint.json diff --git a/types/jsreport-html-to-xlsx/v1/index.d.ts b/types/jsreport-html-to-xlsx/v1/index.d.ts new file mode 100644 index 0000000000..84b37480aa --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for jsreport-html-to-xlsx 1.4 +// Project: https://github.com/jsreport/jsreport-html-to-xlsx +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ExtensionDefinition } from 'jsreport-core'; +import { Options as BaseOptions } from 'jsreport-xlsx'; + +declare module 'jsreport-core' { + interface Template { + recipe: 'html-to-xlsx' | string; + } +} + +declare namespace JsReportHtml2Xlsx { + interface Options extends BaseOptions { + strategy: string; + } +} + +declare function JsReportHtml2Xlsx(options?: Partial): ExtensionDefinition; + +export = JsReportHtml2Xlsx; diff --git a/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts b/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts new file mode 100644 index 0000000000..9540cf7929 --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/jsreport-html-to-xlsx-tests.ts @@ -0,0 +1,19 @@ +import JsReport = require('jsreport-core'); +import JsreportHtml2Xlsx = require('jsreport-html-to-xlsx'); +import JsreportXlsx = require('jsreport-xlsx'); + +const jsreport = JsReport(); +jsreport.use(JsreportXlsx()); +jsreport.use(JsreportHtml2Xlsx()); + +(async () => { + const content = `
test
`; + await jsreport.init(); + const resp = await jsreport.render({ + template: { + content, + engine: 'none', + recipe: 'xlsx' + } + }); +})(); diff --git a/types/jsreport-html-to-xlsx/v1/tsconfig.json b/types/jsreport-html-to-xlsx/v1/tsconfig.json new file mode 100644 index 0000000000..6b073aa725 --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "esnext" + ], + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "jsreport-html-to-xlsx": [ "jsreport-html-to-xlsx/v1" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsreport-html-to-xlsx-tests.ts" + ] +} diff --git a/types/jsreport-html-to-xlsx/v1/tslint.json b/types/jsreport-html-to-xlsx/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jsreport-html-to-xlsx/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }