nodejs version: 12.18.4
moment-timezone version:0.5.31
moment version: ^2.29.0
ts-node version: happens both in 9.0.0(latest), 8.6.2
command: ts-node --files server/app.ts --project server/tsconfig.build.json
usage
import moment from 'moment-timezone'
moment(somedate).tz(sometimezone)
No @types/moment or @types/moment-timezone installed since deprecated.
What could be the reason ?
PS: Already checked this Issue
I'm having exactly the same issue.
node version: 12.14.1
moment version: 2.24.0
moment-timezone version: 0.5.31
ts-node version: 8.3.0
Usages:
import * as moment from 'moment';
import 'moment-timezone';
moment.tz.setDefault('UTC');
import * as moment from 'moment-timezone';
moment.tz.setDefault('UTC');
md5-3af2c6f3090bd525163b2fc71b7688ef
TS2339: Property 'tz' does not exist on type 'typeof moment'.
Any update regarding this ?
I resolved this by downgrading the moment-timezone package to 0.5.28 (instead of 0.5.31).
I found that the offending lines in 0.5.31 with my setup are:
index.d.ts:
zonesForCountry<T extends true>(country: string, with_offset: T): T extends true ? MomentZoneOffset[] : never;
zonesForCountry<T extends false>(country: string, with_offset?: T): T extends false ? string[] : never;
Most helpful comment
I resolved this by downgrading the
moment-timezonepackage to0.5.28(instead of0.5.31).I found that the offending lines in
0.5.31with my setup are:index.d.ts: