2020-06-23 14:28:31 |
Galen Charlton |
description |
Starting with 0.5.29, moment-timezone now includes [0] an index.d.ts that adds Typescript type definitions. Unfortunately, this breaks how moment-timezone has been used to date. Here's an example of the ng build errors:
ERROR in app/core/format.service.ts:164:62 - error TS2709: Cannot use namespace 'Moment' as a type.
164 momentizeIsoString(isoString: string, timezone: string): Moment {
~~~~~~
app/core/format.service.ts:171:76 - error TS2709: Cannot use namespace 'Moment' as a type.
171 momentizeDateString(date: string, timezone: string, strict?, locale?): Moment {
~~~~~~
app/core/format.service.ts:178:80 - error TS2709: Cannot use namespace 'Moment' as a type.
178 momentizeDateTimeString(date: string, timezone: string, strict?, locale?): Moment {
~~~~~~
app/core/format.service.ts:185:89 - error TS2709: Cannot use namespace 'Moment' as a type.
Pinning moment-timezone to its current value of 0.5.27 rather than ^0.5.27 avoids the error, although we should figure out how to properly import and use a Typescript-compatible moment-timezone.
Evergreen master |
Starting with 0.5.29, moment-timezone now includes [0] an index.d.ts that adds Typescript type definitions. Unfortunately, this breaks how moment-timezone has been used to date. Here's an example of the ng build errors:
ERROR in app/core/format.service.ts:164:62 - error TS2709: Cannot use namespace 'Moment' as a type.
164 momentizeIsoString(isoString: string, timezone: string): Moment {
~~~~~~
app/core/format.service.ts:171:76 - error TS2709: Cannot use namespace 'Moment' as a type.
171 momentizeDateString(date: string, timezone: string, strict?, locale?): Moment {
~~~~~~
app/core/format.service.ts:178:80 - error TS2709: Cannot use namespace 'Moment' as a type.
178 momentizeDateTimeString(date: string, timezone: string, strict?, locale?): Moment {
~~~~~~
app/core/format.service.ts:185:89 - error TS2709: Cannot use namespace 'Moment' as a type.
Pinning moment-timezone to its current value of 0.5.27 rather than ^0.5.27 avoids the error, although we should figure out how to properly import and use a Typescript-compatible moment-timezone.
[0] https://github.com/moment/moment-timezone/blob/develop/changelog.md
Evergreen master |
|