From 0ba1b6eb6f0954535cb63c4c6637095b91402a44 Mon Sep 17 00:00:00 2001 From: Arnaud Ferrand Date: Wed, 18 Oct 2023 10:01:55 +0100 Subject: [PATCH] adds mandatory key parameter, makes events optional --- examples/nodejs-example/nodejs-example.js | 3 ++- packages/geosearch-core/index.d.ts | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/nodejs-example/nodejs-example.js b/examples/nodejs-example/nodejs-example.js index 377f5da..dee3676 100644 --- a/examples/nodejs-example/nodejs-example.js +++ b/examples/nodejs-example/nodejs-example.js @@ -1,3 +1,4 @@ +// @ts-check const { OpenCageGeoSearchPlugin } = require('@opencage/geosearch-core'); // eslint-disable-next-line import/no-extraneous-dependencies @@ -6,7 +7,7 @@ require('isomorphic-unfetch'); console.log(typeof OpenCageGeoSearchPlugin); const options = { - key: process.env.OPENCAGE_SEARCH_TOKEN, + key: process.env.OPENCAGE_SEARCH_TOKEN || '', }; const plugin = OpenCageGeoSearchPlugin(options); diff --git a/packages/geosearch-core/index.d.ts b/packages/geosearch-core/index.d.ts index e01bdb6..7bea59b 100644 --- a/packages/geosearch-core/index.d.ts +++ b/packages/geosearch-core/index.d.ts @@ -7,6 +7,10 @@ import { declare module '@opencage/geosearch-core' { interface OpenCageGeoSearchPluginOptions { + /** + * The GEOSEARCH Key + */ + key: string; /** * restricts the possible results to a defined bounding box. * @@ -92,6 +96,6 @@ declare module '@opencage/geosearch-core' { export function OpenCageGeoSearchPlugin( options: OpenCageGeoSearchPluginOptions, - events: OpenCageGeoSearchPluginEvents + events?: OpenCageGeoSearchPluginEvents ): AutocompletePlugin; }