Skip to content

An example repository for using typescript and webworkers with webpack

Notifications You must be signed in to change notification settings

zlepper/typescript-webworker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains an example of how to get typescript working with webworkers. Working in this case being without compile errors, and so messages can be passed back and forth. Webpack is used for bundling worker files, so they get transpiled down to native javascript.

The 3 important files can be found in the src directory.

The first one is index.ts, which contains the main application code, and where the webworker is started from.

Next there is test.worker.ts which is the actual webworker. Other than the available subset of the browser apis available, there is nothing special about this file.

Last we have the file-loader.d.ts-file which contains a declaration for the webpack file-loader, ensuring that typescript infers the correct types when it's used.

About

An example repository for using typescript and webworkers with webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published