Skip to content

Commit

Permalink
Fix for issue 41 - change Map to unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubzloczewski committed Feb 22, 2023
1 parent 2f4a57e commit cd25f49
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"import": "./dist/set-has.mjs",
"default": "./dist/set-has.js"
},
"./map-constructor": {
"types": "./dist/map-constructor.d.ts",
"import": "./dist/map-constructor.mjs",
"default": "./dist/map-constructor.js"
},
"./utils": {
"types": "./dist/utils.d.ts",
"import": "./dist/utils.mjs",
Expand Down
3 changes: 3 additions & 0 deletions src/entrypoints/map-constructor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface MapConstructor {
new(): Map<unknown, unknown>
}
1 change: 1 addition & 0 deletions src/entrypoints/recommended.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/// <reference path="json-parse.d.ts" />
/// <reference path="array-includes.d.ts" />
/// <reference path="set-has.d.ts" />
/// <reference path="map-constructor.d.ts" />
9 changes: 9 additions & 0 deletions src/tests/map-constructor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {doNotExecute, Equal, Expect} from "./utils";

doNotExecute(() => {
const map = new Map();

const result = map.get('foo');

type tests = [Expect<Equal<typeof result, unknown>>];
});

0 comments on commit cd25f49

Please sign in to comment.