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

export partial and strict #140

Merged
merged 10 commits into from
Sep 5, 2022
Merged

export partial and strict #140

merged 10 commits into from
Sep 5, 2022

Conversation

iambumblehead
Copy link
Owner

@iambumblehead iambumblehead commented Sep 4, 2022

support these

import esmock, { partial, strict } from 'esmock'

esmock(...args)
esmock.p(...args)
esmock.partial(...args)
esmock.partial.p(...args)
esmock.strict(...args)
esmock.strict.p(...args)
partial(...args)
partial.p(...args)
strict(...args)
strict.p(...args)

@iambumblehead
Copy link
Owner Author

@jakebailey I hope it is not rude to ask for your help. The esmock's interface is not easily described in typescript and I'm not sure how to achieve passing results here. I don't want the types file to be big but maybe its inevitable. Would you give me your advice?

@iambumblehead
Copy link
Owner Author

where the typescript errors occur, this issue seems related microsoft/TypeScript#22063

if typescript supported simplified function declarations this file would be easier to write

src/esmock.d.ts Outdated Show resolved Hide resolved
@iambumblehead
Copy link
Owner Author

I'm leaning toward exporting partial as the default, with high-chance the next PR would change that. I need to mention it because it would be obnoxious if I take help from you, then, right after, change the interface in some way you disagree with.

@jakebailey
Copy link
Contributor

I'm leaning toward exporting partial as the default, with high-chance the next PR would change that. I need to mention it because it would be obnoxious if I take help from you, then, right after, change the interface in some way you disagree with.

Don't worry about it, it's your library. Truthfully I can't use it anymore because of bugs with loaders and coverage gathering. :(

@iambumblehead
Copy link
Owner Author

probably "esmock.partial.p" and "esmock.strict.p" will be dropped from the tests. typescript doesn't handle the inteface

@iambumblehead
Copy link
Owner Author

@tripodsan please review

I'm interested to make a follow-up PR that sets partial as the default export for the 2.0 release

@iambumblehead
Copy link
Owner Author

typescript tests are passing here and so changes here do work with typescript, though I haven't used them in typescript-aware editor.

@iambumblehead
Copy link
Owner Author

iambumblehead commented Sep 4, 2022

screenshots from terminal emacs and vscode. I think it is OK this way,
Screen Shot 2022-09-04 at 2 08 48 PMScreen Shot 2022-09-04 at 2 08 28 PM

Screen Shot 2022-09-04 at 2 20 27 PMScreen Shot 2022-09-04 at 2 20 38 PMScreen Shot 2022-09-04 at 2 20 59 PM

Copy link
Collaborator

@tripodsan tripodsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iambumblehead iambumblehead merged commit 336540f into master Sep 5, 2022
@iambumblehead iambumblehead deleted the export-partial-and-strict branch September 5, 2022 16:29
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.

4 participants