-
Notifications
You must be signed in to change notification settings - Fork 1
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
Motivation for inferring that a given worker is a module worker #7
Comments
I hadn't thought about the readability benefit here actually. What aspect of that do you feel is important to maintain? From a tooling perspective there is some minor non-analyzability concerns where I suppose the tool can already infer that the Forgetting to add |
At the moment, as a reader, if you don't see an options object passed you can assume it is a classic worker. This change will result in having to also check how the url loaded by the module is defined. In addition, this is implicit knowledge, so for new developers looking at documentation, they may not realize that there is this second implicit meaning of This isn't a critical aspect, but I would like this to be thought through if we change this. It shouldn't be justified from the perspective that it is more ergonomic to write the code. Writing is a less frequent action than reading. |
If we don't want to infer |
I agree with Nicolo that having an early error for attempting to load the worker as a script would be worthwhile. With that, I'd be open to considering removing the inference if the arguments for readability are greater than the static analysis ones here. The only other static analysis risk I can think of is cases where users write |
This is a minor thing, but one section of the readme points out that
{type: module}
will be inferred:This seems bad for readability and adds additional overhead to the act of reading. It reduces typing time, but reading time is more significant. I lean towards keeping this explicit. Do we have other reasons why this would be inferred?
The text was updated successfully, but these errors were encountered: