Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Commit

Permalink
docs: Added Typescript integration to the readme (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlagier authored and joshwiens committed Sep 25, 2017
1 parent 5c3003e commit 13f586b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ self.postMessage({foo: 'foo'})
self.addEventListener('message', (event) => { console.log(event); });
```

### Integrating with TypeScript

To integrate with TypeScript, you will need to define a custom module for the exports of your worker. You will also need to cast the new worker as the `Worker` type:

**typings/custom.d.ts**
```
declare module "worker-loader!*" {
const content: any;
export = content;
}
```

**App.ts**
```
import * as MyWorker from "worker-loader!../../worker";
const worker: Worker = new MyWorker();
```

<h2 align="center">Maintainers</h2>

<table>
Expand Down

0 comments on commit 13f586b

Please sign in to comment.