Skip to main content

TypeScript Support

React HERE Maps is built with TypeScript and provides comprehensive type definitions for a superior development experience.

Installation

Install the HERE Maps type definitions:
The library’s own types are included automatically.

Type Imports

Component Props

HERE Maps Types

Use official HERE Maps types from @types/heremaps:

Zod Schema Validation

The library uses Zod for runtime prop validation. You can access schemas for custom validation:

Generic Components

Typed Marker Component

Generic Map Component

Utility Types

Coordinate Types

Map Configuration Types

Type Guards

Coordinate Validation

Context Typing

Typed Map Context Hook

Advanced Patterns

Discriminated Unions

Builder Pattern

Type-Safe Configuration

Environment Variables

Best Practices

Enable strict TypeScript settings in tsconfig.json:
Use specific types instead of any:
Use import type for type-only imports:
Use generics for flexible, reusable components:

See Also

Components

Component API reference

Hooks

Custom hooks with types

Examples

TypeScript examples