This is the documentation of version 0.62.1. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias CommonGeocodeAndFuzzySearchParams

    Common parameters shared between fuzzy search and geocoding services.

    These parameters control search behavior that applies to both fuzzy search and geocoding operations, including autocomplete mode, pagination, and geographic filtering.

    Used by:

    type CommonGeocodeAndFuzzySearchParams = {
        cursor?: string;
        filters?: GeographicFilters;
        geoBias?: GeoBias;
        typeahead?: boolean;
    }
    Index
    cursor?: string

    Continues a previous search: its response's nextCursor, passed back unchanged alongside the same parameters. Leave it out for the first page.

    The value is opaque: the SDK mints it and only the SDK reads it, which lets the pagination mechanism change without breaking callers. Passing a value this SDK did not produce throws.

    let response = await discoverPlaces({ query: 'cafe', limit: 20 });

    while (response.properties?.nextCursor) {
    response = await discoverPlaces({ query: 'cafe', limit: 20, cursor: response.properties?.nextCursor });
    }

    Which countries results may come from: see GeographicFilters. Fuzzy search's filters also carries PlaceFilters; geocoding's also carries geographyTypes.

    filters: { countries: ['NL', 'BE'] }
    
    geoBias?: GeoBias

    Where to look: a point with an optional radius, or a bounding box.

    A point without radiusMeters biases the ranking; with one, or with a boundingBox, results are confined to that area. Leave it out to search without a geographic bias.

    geoBias: { position: [4.9, 52.3], radiusMeters: 2000 }
    geoBias: { boundingBox: [4.8, 52.3, 5.0, 52.4] }
    typeahead?: boolean

    Enable predictive/autocomplete mode for partial input queries.

    When true, the query is treated as incomplete text being typed by a user, and the search returns suggestions that match the partial input.

    Autocomplete Behavior:

    • Optimized for real-time search-as-you-type
    • Returns results that start with or contain the query
    • Better for interactive search boxes
    • Lower result quality thresholds to show more options

    Regular Search (false):

    • Treats query as complete input
    • Higher quality thresholds
    • Better for final search submission
    false
    
    // Autocomplete mode for "Amst" input
    typeahead: true // Returns: Amsterdam, Amstelveen, etc.

    // Regular search mode
    typeahead: false // Expects complete query