paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 387 forks source link

Installed es6-shim types reference type "object", rather than "Object"? #445

Closed dtgriscom closed 6 years ago

dtgriscom commented 6 years ago

In using TypeScript and TypeDoc, I was having trouble with tsc errors on undefined Promise types. So, after some Googling, I installed es6-shim:

npm install --save @types/es6-shim

Now, tsc complains that it can't find name object:

tsc --project fpui --watch
node_modules/@types/es6-shim/index.d.ts(596,29): error TS2304: Cannot find name 'object'.
node_modules/@types/es6-shim/index.d.ts(604,20): error TS2304: Cannot find name 'object'.
node_modules/@types/es6-shim/index.d.ts(605,20): error TS2304: Cannot find name 'object'.
1:55:04 PM - Compilation complete. Watching for file changes.

Looking at the cited lines, I find that the WeakMap type's argument refer to the type object, instead of what I would assume should be Object:

interface WeakMap<K extends object, V> {
    delete(key: K): boolean;
    get(key: K): V | undefined;
    has(key: K): boolean;
    set(key: K, value: V): WeakMap<K, V>;
}

interface WeakMapConstructor {
    new <K extends object, V>(): WeakMap<K, V>;
    new <K extends object, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>;
    prototype: WeakMap<any, any>;
}

I'm using tsc version 2.0.10, and npm version 3.10.10.

Any suggestions?

ljharb commented 6 years ago

This project doesn't use typescript, and we don't support or maintain the TypeScript definitions for it.

Please file an issue on the DefinitelyTyped repo instead.

dtgriscom commented 6 years ago

Thanks, Dan