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

No default export warning in vscode #22

Open
birkskyum opened this issue Feb 7, 2022 · 0 comments
Open

No default export warning in vscode #22

birkskyum opened this issue Feb 7, 2022 · 0 comments

Comments

@birkskyum
Copy link

birkskyum commented Feb 7, 2022

When writing:

import Worker from 'web-worker';

I similarly see: No default export found in imported module "web-worker" as a vscode warning

It's strange, because to me it looks like there is a default export:

type ConstructorOf<C> = { new (...args: any[]): C }

declare const _default: ConstructorOf<Worker>
export default _default
niedzielski added a commit to niedzielski/web-worker that referenced this issue May 18, 2022
- Add types entry exports[0]. I'm sad TypeScript doesn't seem to be
  using the plain old types field but it isn't.
- Replace index.d.ts' `export default` with `export =`[1]. From what I
  can tell, `module.exports` is always used for all entrypoints so this
  is the correct definition.
- Use the Worker var declaration from lib.dom.d.ts. I think this is fine
  since the old definition already used the Worker interface from the
  same file. This typing is more accurate, easier to read,d less likely
  to become outdated, and less code.

Bug: developit#20 developit#22

[0]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#packagejson-exports-imports-and-self-referencing
[1]: microsoft/TypeScript#7185 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant