Skip to content

Commit 5467dfe

Browse files
Fix TS issue.
1 parent 5134d69 commit 5467dfe

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/wasm-benchmark/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { createBenchmark } from "./lib/tests";
22
import { getConfigOptionsFromURL } from "./lib/utils";
33
import render from "./ui/render";
44

5+
import type NutrientViewer from "@nutrient-sdk/viewer";
6+
57
export const NutrientWindow = window as unknown as Window & {
6-
NutrientViewer: typeof import("@nutrient-sdk/viewer"),
8+
NutrientViewer: typeof NutrientViewer,
79
ga: any
810
}
911

examples/wasm-benchmark/src/lib/tests.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ export function createBenchmark(pdf: any, licenseKey: any, conf: any) {
9696
async () => {
9797
const instance = await prepareInstance();
9898

99-
const annotation = new (NutrientWindow.NutrientViewer.Annotations as any).TextAnnotation({
99+
// TypeScript is failing to recognize NutrientViewer.Annotations and Geometry
100+
const annotation = new NutrientWindow.NutrientViewer.Annotations.TextAnnotation({
100101
pageIndex: 0,
101102
text: { format: "plain", value: "test" },
102-
boundingBox: new (NutrientWindow.NutrientViewer as any).Geometry.Rect({
103+
boundingBox: new NutrientWindow.NutrientViewer.Geometry.Rect({
103104
width: 200,
104105
height: 30,
105106
}),

0 commit comments

Comments
 (0)