0

I have previously used moment in my project, and want to add the moment-timezone:

npm i moment-timezone

I import them at my project:

import * as moment from "moment";
import 'moment-timezone';

When I run it, I get errors:

"moment-timezone/index.d.ts(47,77): error TS1005: ';' expected."

I have downgraded to:

"@types/moment-timezone": "^0.5.7",

according with: How to fix this ERROR in node_modules/@types/moment-timezone/moment-timezone.d.ts(50,73)

If I do above, I instead get following error in Reddux:

node_modules/redux/index.d.ts(38,38): error TS1005: '=' expected.

I also have tried lower versions of moment-timezone but still does not work. Anyone know how to solve it?

Arte2
  • 309
  • 4
  • 19
  • `When I run it, I get errors` which version gets the first error? – Jaromanda X Oct 28 '20 at 08:49
  • what does that line look like in YOUR version of `moment-timezone/index.d.ts` ... the file looks fine in the repo – Jaromanda X Oct 28 '20 at 08:51
  • Line is "T extends true ? MomentZoneOffset[] : never;" (however, I got multiple syntax errors in node modules, this one is an example. First version is the current one: "moment-timezone": "^0.5.31", and : "@types/moment-timezone": "^0.5.7", – Arte2 Oct 28 '20 at 09:47
  • don't you mean `zonesForCountry(country: string, with_offset: T): T extends true ? MomentZoneOffset[] : never;` - perhaps you have an old version of typescript? – Jaromanda X Oct 28 '20 at 12:43
  • I have an older version of typescript but I cant change it since I develop for SharePoint (which does not support the latest versions). – Arte2 Oct 28 '20 at 17:42
  • "older version" ... how much older – Jaromanda X Oct 28 '20 at 22:07
  • Typescript version 2.4.2 – Arte2 Oct 29 '20 at 09:15
  • I guess Typescript has changed a lot from that to 4.0 - I mean, you can't even use typescript playground with a version less than 3.3.3 – Jaromanda X Oct 29 '20 at 09:23

0 Answers0