-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 jest-haste-map-types #7951
fix jest-haste-map-types #7951
Conversation
@@ -33,10 +33,10 @@ beforeEach(() => { | |||
roots: ['./packages/jest-resolve-dependencies'], | |||
}); | |||
return Runtime.createContext(config, {maxWorkers, watchman: false}).then( | |||
(hasteMap: any) => { | |||
(runtimeContext: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never actually a HasteMap
instance lol, HasteMap
s don't even have a .resolver
property 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic, thank you so much for fixing it!
:) do any other locations where we could get rid of |
Yeah, |
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. |
Summary
jest-haste-map
wants to do bothexport = HasteMap
and multipleexport type SomeType
. Until we migrate it over to use a proper ESM default export, the way to do this in TypeScript is namespaces - see this StackOverflow answer. This fixes ourjest-haste-map/build/index.d.ts
:Diff
@babel/plugin-transform-typescript
does not support namespaces (because it's not possible to really support them), but we only want to put a few types in them, so I wrote a Babel plugin that strips them away in those simple cases. This way,yarn build
works andjest-haste-map/build/index.js
is unchanged.Test plan
Manual inspection of
jest-haste-map/build/index.{js,d.ts}