Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdfjs-dist expand exports, export pdfjs-dist from react-pdf #38117

Merged
merged 4 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions types/pdfjs-dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

/// <reference lib="dom"/>

declare const version: string;

declare const GlobalWorkerOptions: GlobalWorkerOptions;

interface GlobalWorkerOptions {
workerSrc: string;
}

interface PDFPromise<T> {
isResolved(): boolean;
isRejected(): boolean;
Expand Down
1 change: 1 addition & 0 deletions types/react-pdf/dist/entry.parcel.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Document } from './Document';
export { default as Page } from './Page';
export { default as Outline } from './Outline';
export { default as pdfjs } from './pdfjs-dist';
1 change: 1 addition & 0 deletions types/react-pdf/dist/entry.webpack.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Document } from './Document';
export { default as Page } from './Page';
export { default as Outline } from './Outline';
export { default as pdfjs } from './pdfjs-dist';
3 changes: 3 additions & 0 deletions types/react-pdf/dist/pdfjs-dist.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as pdfjs from 'pdfjs-dist';

export default pdfjs;
7 changes: 2 additions & 5 deletions types/react-pdf/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import Document from './dist/Document';
import Page from './dist/Page';
import Outline from './dist/Outline';
import pdfjs from './dist/pdfjs-dist';

export {
Document,
Page,
Outline
};
export { pdfjs, Document, Page, Outline };
4 changes: 3 additions & 1 deletion types/react-pdf/react-pdf-tests.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import { Document, Page } from 'react-pdf';
import { Document, Page, pdfjs } from 'react-pdf';
import { PDFDocumentProxy } from 'pdfjs-dist';

pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;

interface State {
numPages: number | null;
pageNumber: number;
Expand Down