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

Fix types #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix types #26

wants to merge 1 commit into from

Conversation

niedzielski
Copy link

@niedzielski niedzielski commented May 18, 2022

  • Add types entry exports. 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 =. 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, less likely
    to become outdated, and less code.

Bug: #20 #22

- 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)
@niedzielski
Copy link
Author

Hey @developit! Thank you for your awesome library! I'm a 1st time contributor to this repo so I need your bump to allow the workflow bots to run.

@niedzielski
Copy link
Author

Hey @developit! Any chance you could take a look at this? My team is loving this library but all our types are showing up as any 😄

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

Successfully merging this pull request may close these issues.

1 participant