From fd350d53db1fc97a947b47e444adb2413acb816a Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sat, 1 Apr 2017 12:18:23 +0100 Subject: [PATCH] fixed some typescript compile issues --- ts/docx/paragraph/index.ts | 5 +++-- ts/docx/run/picture-run.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ts/docx/paragraph/index.ts b/ts/docx/paragraph/index.ts index a63861c3a7..5c42381311 100644 --- a/ts/docx/paragraph/index.ts +++ b/ts/docx/paragraph/index.ts @@ -1,3 +1,4 @@ +import { IData } from "../../media/data"; import { Num } from "../../numbering/num"; import { Run } from "../run"; import { PictureRun } from "../run/picture-run"; @@ -37,8 +38,8 @@ export class Paragraph extends XmlComponent { return run; } - public createPictureRun(imagePath: string): PictureRun { - const run = new PictureRun(imagePath); + public createPictureRun(imageData: IData): PictureRun { + const run = new PictureRun(imageData); this.addRun(run); return run; } diff --git a/ts/docx/run/picture-run.ts b/ts/docx/run/picture-run.ts index fdf2310c4b..038d1fc7bf 100644 --- a/ts/docx/run/picture-run.ts +++ b/ts/docx/run/picture-run.ts @@ -1,10 +1,16 @@ +import { IData } from "../../media/data"; import { Run } from "../run"; import { Drawing } from "./run-components/drawing"; export class PictureRun extends Run { - constructor(imagePath: string) { + constructor(imageData: IData) { super(); - this.root.push(new Drawing(imagePath)); + + if (imageData === undefined) { + throw new Error("imageData cannot be undefined"); + } + + this.root.push(new Drawing(imageData)); } }