moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.82k stars 835 forks source link

How can I use moment-timezone with 10 year data range with Typescript types #1089

Open garethdn opened 8 months ago

garethdn commented 8 months ago

If I import moment timezone with

import * as moment from 'moment-timezone';

I get all the required typings but all the data is preloaded. If I require only the 10 year range and I import like so

import moment from "moment-timezone/builds/moment-timezone-with-data-10-year-range"

I get only the data I want but no typings. Likewise if I import only the library with no data, I get no typings

import moment from 'moment-timezone/moment-timezone

gilmoreorless commented 7 months ago

You're right — we currently only have types defined for moment-timezone and moment-timezone/moment-timezone-utils, but not any of the other import paths. I'll take a look at adding some extra definition files.