Search code examples
compiler-errorsbing-mapstypescript1.5

TypeScript: Build: Supplied parameters do not match any signature of call target


I have this code (trimmed):

class cSubjectSite  {

    collectionHomeMarker: Microsoft.Maps.EntityCollection;

    showAddressMarker() {
        var opts: Microsoft.Maps.EntityCollectionOptions = { 
            zIndex: zIndex_HomeMarker, bubble: true, visible: true 
        };
    }
    // Compiler error on this line:
    this.collectionHomeMarker = new Microsoft.Maps.EntityCollection(opts);
}

This looks good to me. Here from the declaration Microsoft.Maps.d.ts:

export interface EntityCollectionOptions {
    bubble?: boolean;
    visible?: boolean;
    zIndex?: number;
}

export class EntityCollection implements Entity {
    EntityCollection(options?: EntityCollectionOptions);
    // Etc.

There is also a second declaration file I am using (Microsoft.Maps.AdvancedShapes.d.ts) for extended features which has another definition for EntityCollection:

export class EntityCollection implements Entity {
    constructor(options?: EntityCollectionOptions);

It looks like the two def files are targeting different ts versions (different constructor syntax)? I do not know enough about def files to say.

I am using VS 2013 with ts 1.5. I made sure my path variable and my proj file were both referencing v1.5. I obtained my Bing Maps def files from Nuget.

I am new to typescript so I may be missing something fundamental.

  • Brad

Solution

  • So it looks like a bad declaration. I changed the Microsoft.Maps.d.ts EntityCollection declaration to:

    export class EntityCollection implements Entity {
        constructor(options?: EntityCollectionOptions);
    

    This apparently is the correct syntax for the version of TS I am using (1.5).