opened
nekdolan
username_0
When I try to bundle my worker.ts it raises an error
```
error: TS2339 [ERROR]: Property 'postMessage' does not exist on type 'Window & typeof globalThis'.
        self.postMessage(data);
```

In Deno
```
deno 1.5.1
v8 8.7.220.3
typescript 4.0.3
```
Deno bundle can't compile worker files
issue
created
kitsonk
username_1
```

Where the `tsconfig.json` contains:

```js 
{
  "compilerOptions": {
    "lib": [ "deno.worker" ]
  }
}
```
comment
created
nekdolan
username_0
Thanks @username_1 `deno bundle --no-check` works
comment
created
kitsonk
username_1
Actually, I realised I made a comment in the code.

https://github.com/denoland/deno/blob/96e03e0b93bf75035887ce02880b832123e3c86d/cli/main.rs#L344

Ultimately we just need to agree on how to deal with this.  @ry @bartlomieju thoughts?
comment
created
nayeemrmn
username_2
This is basically #6753 (`deno cache --worker`), the flag would be shared like [similar ones](https://github.com/denoland/deno/blob/5f7c80986fd9cff6a65d4e419fc2972abe992ccf/cli/flags.rs#L503-L513) are.
comment
created
kitsonk
username_1
@username_2 you are right as usual... `deno bundle --worker` is what it should be, nothing to debate... I forgot we had agreed that for `deno cache`.
comment
created
kitsonk
username_1
Actually based on #8089 there is clearly things to discuss...
comment
created
nekdolan
username_0
I'm not sure how it could be done without the proposed/reverted flag `--worker` . I can understand that cache could work without it but how would you keep the linkage when you bundle them, given that you don't know where or how the scripts will be deployed. Would we just keep a relative link to the bundled worker in the script? Would that work on a normal webpage?
comment