Skip to content

Object.defineProperties: "Index Signature is missing in type {}" #6535

Closed
@felixrieseberg

Description

@felixrieseberg

The following is valid ES5.1 JavaScript, but yields an error when used in TypeScript. TS2345: Argument of type '{}' is not assignable to parameter of type 'PropertyDescriptorMap'. Index signature is missing in type '{}'. A side effect is that Code's IntelliSense considers this JavaScript to be invalid.

var source = {get name() { return 'source'}};
var target = {};

var map = Object.keys(source).reduce(function (descriptors, key) {
    descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
    return descriptors;
}, {});

Object.defineProperties(target, map);

I'd love to fix this, but I'm not sure where to look. Any suggestions?

(Debug info: Tested with Version 1.8.0-dev.20160119)

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions