Skip to content

Commit

Permalink
Merge pull request #166 from evansiroky/typescript-import-fix
Browse files Browse the repository at this point in the history
Add entry points to assist TypeScript
  • Loading branch information
evansiroky authored Jan 25, 2024
2 parents e913e82 + 1b11eda commit f32bb23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ This library does an exact geographic lookup which has tradeoffs. The results ar

## Entry Points

As of version 8, node-geo-tz offers the ability to choose from the three different timezone boundary products that the [timezone-boudary-builder](https://github.com/evansiroky/timezone-boundary-builder) project produces.
As of version 8, node-geo-tz offers the ability to choose from the three different timezone boundary products that the [timezone-boudary-builder](https://github.com/evansiroky/timezone-boundary-builder) project produces. If using TypeScript, it may be necessary to use the `dist` entry points (see [issue #165](https://github.com/evansiroky/node-geo-tz/issues/165)).

### Alike Since 1970 (default)

The default data product used by this library are unioned timezones that are alike since 1970. This is a breaking change from versions below version 8 that used timezone identifiers that generally had a minimum of one timezone per country. In a number of places, the timezone identifier returned will be that which has the highest population among all timezone identifiers with similar timekeeping methods since 1970.

```js
const { find } = require('geo-tz')
// const { find } = require('geo-tz/dist/find-1970') // TypeScript-compatible import

find(12.826174, 45.036933) // ['Asia/Riyadh']
```
Expand All @@ -44,6 +45,7 @@ A comprehensive dataset is available to query for all timezone identifiers avail

```js
const { find } = require('geo-tz/all')
// const { find } = require('geo-tz/dist/find-all') // TypeScript-compatible import

find(12.826174, 45.036933) // ['Asia/Aden']
```
Expand All @@ -56,6 +58,7 @@ A dataset containing a unioned set of timezones that share the same timekeeping

```js
const { find } = require('geo-tz/now')
// const { find } = require('geo-tz/dist/find-now') // TypeScript-compatible import

find(12.826174, 45.036933) // ['Europe/Moscow']
```
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@
"import": "./dist/find-now.js",
"require": "./dist/find-now.js",
"types": "./dist/find-now.d.ts"
},
"./dist/find-1970": {
"main": "./dist/find-1970.js",
"import": "./dist/find-1970.js",
"require": "./dist/find-1970.js",
"types": "./dist/find-1970.d.ts"
},
"./dist/find-all": {
"main": "./dist/find-all.js",
"import": "./dist/find-all.js",
"require": "./dist/find-all.js",
"types": "./dist/find-all.d.ts"
},
"./dist/find-now": {
"main": "./dist/find-now.js",
"import": "./dist/find-now.js",
"require": "./dist/find-now.js",
"types": "./dist/find-now.d.ts"
}
},
"scripts": {
Expand Down

0 comments on commit f32bb23

Please sign in to comment.