From 68cda732a932a2ab40e4841ad6946d9d61400b0d Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Tue, 9 Nov 2021 18:56:42 +0000 Subject: [PATCH] docs(README): explain type guards --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 80c957a6..22cd5b0b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ This package provides [TypeScript guards](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) for the Google Maps JavaScript API. +A type guard (or type predicate) is an expression that performs a runtime check that guarantees the type in some scope. Type guards are used to narrow the type of a variable or parameter. + ## Documentation For the complete API check the [reference documentation](https://googlemaps.github.io/js-typescript-guards/index.html). @@ -40,4 +42,4 @@ if (isLatLngLiteral(latLng)) { lat = latLng.lat(); lng = latLng.lng(); } -``` \ No newline at end of file +```