Skip to content

feat(jest-resolve): expose JestResolver, AsyncResolver and SyncResolver types - #12707

Merged
SimenB merged 7 commits into
jestjs:mainfrom
mrazauskas:feat-expose-resolver-types
Apr 21, 2022
Merged

feat(jest-resolve): expose JestResolver, AsyncResolver and SyncResolver types#12707
SimenB merged 7 commits into
jestjs:mainfrom
mrazauskas:feat-expose-resolver-types

Conversation

@mrazauskas

Copy link
Copy Markdown
Contributor

Summary

Jest 28 does not expose typings for custom resolver, because of bundling. Before it was possible to import types from build directory.

This PR is exposing JestResolver, AsyncResolver and SyncResolver types which would be very useful for authors of custom resolvers.

Test plan

Type tests are added.

Comment thread packages/jest-resolve/src/defaultResolver.ts Outdated
Comment on lines +12 to +13
FindNodeModuleConfig,
ResolveModuleConfig,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Typings for static methods of Resolver class.

return pnpResolver(path, options);
}

// @ts-expect-error: TODO packageFilter typings should be fixed in @types/resolve

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the error?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hah, commented before your comments showed up 🙈

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

packageFilter() takes three arguments, but @types/resolve defines just two.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 will you be sending a PR to DT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure (;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants