-
-
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
feat(types): Add type definition for default constructor in IJestHasteMap #14612
Conversation
…eMap This commit adds a type definition for the default constructor in the IJestHasteMap interface. Now, the type system will recognize the default constructor as a new instance of IHasteMap, allowing for more accurate type checking and improved code assistance. Changes Made: - Added 'default' property to the IJestHasteMap interface with type (new (options: Options) => IHasteMap).
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/jest-haste-map/src/index.ts
Outdated
}; | ||
|
||
// @ts-expect-error(property `default is missing in HasteMap class`) |
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.
Can we cast instead or something? Adding type safety followed by a @ts-ignore
seems unfortunate 😅
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.
Can you add type tests? And a changelog entry
ping @SimenB |
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
This commit adds a type definition for the default constructor in the
IJestHasteMap
interface. Now, the type system will recognize the default constructor as a new instance ofIHasteMap
, allowing for more accurate type checking and improved code assistance.Before, when initializing a new HasteMap, the result was of type
any
.After adding type definitions for default constructor, now the result have a type of
IHasteMap
.This will result in improved developer experience while using
jest-haste-map
package.Test plan
Before adding those type definitions, it looked like this :
and the resulting
map
had type ofany
after adding type definitions , now it looks like this :
And the resulting
map
now has the type ofIHasteMap