Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:58:17+00:00 2026-06-17T07:58:17+00:00

Updated TypeScript from 0.8.0.0 to 0.8.1.1 today. The TS compiler now complains about passing

  • 0

Updated TypeScript from 0.8.0.0 to 0.8.1.1 today. The TS compiler now complains about passing null or undefined to a function/method that is overloaded.

For example, the google maps Marker class has a setMap method with 2 overloads. This is taken from the google maps definition file in the Definitely Typed project:

declare module google.maps {
    ...
    export class Marker extends MVCObject {
        ...
        setMap(map: Map): void;
        setMap(map: StreetViewPanorama): void;
        ...
    }
    ...
}

According to the google maps API v3 docs, to remove a marker from a map, you should set its map to null. I previously had this with TS 0.8.0.0 and it worked fine:

var someMarker: google.maps.Marker = (code to initialize marker);
...
someMarker.setMap(null);

TypeScript 0.8.1.1 complains about this with the message:

Ambiguous call expression – could not choose overload.

One fix I tried that did not work was trying to coerce TS into believing null was a reference to a google.maps.Map. This is apparently incorrect syntax, as the compiler complains it expects a ; where the ) is.

someMarker.setMap(null: google.maps.Map);

Here is the fix I have now, which seems to work. Is this the right way to work around this issue?

var nullMap: google.maps.Map = null;
someMarker.setMap(nullMap);

I realize another fix could be to modify the google maps TS definition file to allow an overload of setMap(map: any): void;, but that seems like a bad solution. Is there any other way currently, or planned in future TS builds, to work around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:58:18+00:00Added an answer on June 17, 2026 at 7:58 am

    The way you are working around it now works, but is more verbose than necessary.

    You can specify that you mean null to be of the type google.maps.Map by casting it as such.

    someMarker.setMap(<google.maps.Map>null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just updated to Web Essentials 1.8 and now whenever I build/compile any TypeScript
Updated below: I have a script which has a function I made that calculates
UPDATED: I realise now that I've been misreading the diff, and I have a
UPDATED SOLUTION: With my particular problem, the sort call was inside a Render function
I am playing around with typescript and am trying to create a script that
I found out about TypeScript , and installed the Visual Studio 2012 Plugin ,
UPDATED I am trying to create an HtmlHelper Extension that has the ability to
UPDATED I have an application that updates a combobox based on the values selected
UPDATED SCRIPT I'M USING THAT CAUSES LOCKUP...I tried replacing the (Replace:=wdReplaceOne) with (Replace:=wdReplaceAll), but
(Updated due to some confusion over my question) We use this method to generate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.