mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #14334 from pine/feature/es6-weak-map
Add type definitions for es6-weak-map
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import WeakMap = require('es6-weak-map');
|
||||
|
||||
new WeakMap<{}, string>();
|
||||
|
||||
var tuples: [number, string][] = [ [0, 'foo'], [1, 'bar'] ];
|
||||
new WeakMap<number, string>(tuples);
|
||||
|
||||
var map = new WeakMap<{}, string>();
|
||||
var obj = {};
|
||||
|
||||
map.set(obj, 'foo');
|
||||
map.get(obj);
|
||||
map.has(obj);
|
||||
map.delete(obj);
|
||||
map.get(obj);
|
||||
map.has(obj);
|
||||
map.set(obj, 'bar');
|
||||
map.has(obj);
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for es6-weak-map 1.2
|
||||
// Project: https://github.com/medikoo/es6-weak-map
|
||||
// Definitions by: Pine Mizune <https://github.com/pine>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = WeakMap;
|
||||
export as namespace WeakMap;
|
||||
|
||||
interface Iterable<T> {
|
||||
[Symbol.iterator](): Iterator<T>;
|
||||
}
|
||||
|
||||
declare class WeakMap<K, V> {
|
||||
constructor();
|
||||
constructor(iterable: Iterable<[K, V]>);
|
||||
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): WeakMap<K, V>;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"es6-weak-map-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user