Skip to content

Commit

Permalink
feat(types): Add type definition for default constructor in IJestHast…
Browse files Browse the repository at this point in the history
…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).
  • Loading branch information
Mutesa-Cedric authored Oct 11, 2023
1 parent a8c95ce commit de5c282
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/jest-haste-map/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ function copyMap<K, V>(input: Map<K, V>): Map<K, V> {
type IJestHasteMap = HasteMapStatic & {
create(options: Options): Promise<IHasteMap>;
getStatic(config: Config.ProjectConfig): HasteMapStatic;
default: (new (options: Options) => IHasteMap);

Check failure on line 1152 in packages/jest-haste-map/src/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Replace `(new·(options:·Options)·=>·IHasteMap)` with `new·(options:·Options)·=>·IHasteMap`
};
const JestHasteMap: IJestHasteMap = HasteMap;

Check failure on line 1154 in packages/jest-haste-map/src/index.ts

View workflow job for this annotation

GitHub Actions / TypeScript Compatibility

Type 'typeof HasteMap' is not assignable to type 'IJestHasteMap'.

Check failure on line 1154 in packages/jest-haste-map/src/index.ts

View workflow job for this annotation

GitHub Actions / Typecheck Examples and Tests

Type 'typeof HasteMap' is not assignable to type 'IJestHasteMap'.
export default JestHasteMap;

0 comments on commit de5c282

Please sign in to comment.