{"id":16898997,"url":"https://github.com/chrisguttandin/here-maps-type-guards","last_synced_at":"2025-04-11T14:16:51.539Z","repository":{"id":44860795,"uuid":"156565024","full_name":"chrisguttandin/here-maps-type-guards","owner":"chrisguttandin","description":"A guarded version of the TypeScript type definitions for HERE Maps.","archived":false,"fork":false,"pushed_at":"2024-10-17T00:40:21.000Z","size":11060,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-24T12:19:32.298Z","etag":null,"topics":["here","heremaps","types","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisguttandin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-07T15:13:12.000Z","updated_at":"2024-10-17T00:40:25.000Z","dependencies_parsed_at":"2023-02-19T01:01:52.383Z","dependency_job_id":"2c424c5a-4f1a-471e-b201-0be9f049c3c7","html_url":"https://github.com/chrisguttandin/here-maps-type-guards","commit_stats":{"total_commits":1794,"total_committers":2,"mean_commits":897.0,"dds":0.0005574136008918984,"last_synced_commit":"0d8a7833bcd05d84655207efa9d2bf3ec03ec6f7"},"previous_names":[],"tags_count":126,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisguttandin%2Fhere-maps-type-guards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisguttandin%2Fhere-maps-type-guards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisguttandin%2Fhere-maps-type-guards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisguttandin%2Fhere-maps-type-guards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisguttandin","download_url":"https://codeload.github.com/chrisguttandin/here-maps-type-guards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248416344,"owners_count":21099858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["here","heremaps","types","typescript"],"created_at":"2024-10-13T17:46:45.763Z","updated_at":"2025-04-11T14:16:51.507Z","avatar_url":"https://github.com/chrisguttandin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# here-maps-type-guards\n\n**A guarded version of the TypeScript type definitions for HERE Maps.**\n\n[![version](https://img.shields.io/npm/v/here-maps-type-guards.svg?style=flat-square)](https://www.npmjs.com/package/here-maps-type-guards)\n\nThis module provides TypeScript type guards which assure TypeScript that a value of type unknown is actually a [HERE Maps](https://here.com) module. It can be thought of as a scoped version of the [@types/heremaps](https://www.npmjs.com/package/@types/heremaps) module.\n\n## Installation\n\nThis module is available as [npm package](https://www.npmjs.org/package/here-maps-type-guards). It can be installed with the following command:\n\n```shell\nnpm install here-maps-type-guards\n```\n\nIt is not required to include any external type definition files in the tsconfig file in order to use here-maps-type-guards.\n\n## Guards\n\nThis module provides a guard for each of the [submodules](https://developer.here.com/documentation/maps/topics/overview.html#overview__modules) available from HERE Maps.\n\nThe guards are useful to ensure type safety and to do runtime checks at the same time.\n\nAdditionally the globally available `H` object which HERE Maps attaches to the window is also exported. It is of type unknown and needs to be narrowed with at least one guard before it can be used.\n\n### isHereMaps\n\nThis is a guard which checks the availability of the core module.\n\n```typescript\nimport { H, isHereMaps } from 'here-maps-type-guards';\n\nif (isHereMaps(H)) {\n    // H is not unknown anymore.\n}\n```\n\n### isHereMapsWithClusteringNamespace\n\nThis is a guard which checks the availability of the clustering module which includes a check for the core module.\n\n```typescript\nimport { H, isHereMapsWithClusteringNamespace } from 'here-maps-type-guards';\n\nif (isHereMapsWithClusteringNamespace(H)) {\n    // H is not unknown anymore.\n    // H.clustering is also defined.\n}\n```\n\n### isHereMapsWithDataNamespace\n\nThis is a guard which checks the availability of the data module which includes a check for the core module.\n\n```typescript\nimport { H, isHereMapsWithDataNamespace } from 'here-maps-type-guards';\n\nif (isHereMapsWithDataNamespace(H)) {\n    // H is not unknown anymore.\n    // H.data is also defined.\n}\n```\n\n### isHereMapsWithMapEventsNamespace\n\nThis is a guard which checks the availability of the mapevents module which includes a check for the core module.\n\n```typescript\nimport { H, isHereMapsWithMapEventsNamespace } from 'here-maps-type-guards';\n\nif (isHereMapsWithMapEventsNamespace(H)) {\n    // H is not unknown anymore.\n    // H.mapevents is also defined.\n}\n```\n\n### isHereMapsWithServiceNamespace\n\nThis is a guard which checks the availability of the service module which includes a check for the core module.\n\n```typescript\nimport { H, isHereMapsWithServiceNamespace } from 'here-maps-type-guards';\n\nif (isHereMapsWithServiceNamespace(H)) {\n    // H is not unknown anymore.\n    // H.service is also defined.\n}\n```\n\n## Motivation\n\nI also wrote a [blog post](https://media-codings.com/articles/using-typescripts-new-unknown-type-to-safely-handle-global-third-party-libraries) which explains why I actually created this module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisguttandin%2Fhere-maps-type-guards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisguttandin%2Fhere-maps-type-guards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisguttandin%2Fhere-maps-type-guards/lists"}