You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting ton of build errors whenever I try to build my Angular application with any imports from date-fns and am trying to figure out why. Using and running the application after the build shows that the imports work perfectly, and I can use the functions after in the application. It's just my compiler/linter that seems to be complaining. I do have a bunch of older versions for my environment for compatibility reasons, so not sure if one or a few or these are the issue/s, or if it's an issue with the configurations I have set for the build.
Also, are there typings I can possibly import/need to import to resolve these issues?
Here is my code:
import { Locale } from 'date-fns';
import { es, zhCN } from 'date-fns/locale';
...
ngOnInit() {
this.localeImport = zhCN;
// proceeds to use this in another object...
...
}
node_modules/date-fns/typings.d.ts(12359,9): error TS2649: Cannot augment module 'lastDayOfWeekWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12369,9): error TS2649: Cannot augment module 'lastDayOfYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12372,9): error TS2649: Cannot augment module 'lightFormat' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12375,9): error TS2649: Cannot augment module 'max' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12378,9): error TS2649: Cannot augment module 'min' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12381,9): error TS2649: Cannot augment module 'parse' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12384,9): error TS2649: Cannot augment module 'parseISO' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12387,9): error TS2649: Cannot augment module 'parseISOWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12396,9): error TS2649: Cannot augment module 'parseJSON' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12399,9): error TS2649: Cannot augment module 'parseWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12414,9): error TS2649: Cannot augment module 'roundToNearestMinutes' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12417,9): error TS2649: Cannot augment module 'roundToNearestMinutesWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12426,9): error TS2649: Cannot augment module 'set' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12441,9): error TS2649: Cannot augment module 'setDate' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12444,9): error TS2649: Cannot augment module 'setDay' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12447,9): error TS2649: Cannot augment module 'setDayOfYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12450,9): error TS2649: Cannot augment module 'setDayWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12461,9): error TS2649: Cannot augment module 'setHours' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12464,9): error TS2649: Cannot augment module 'setISODay' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12467,9): error TS2649: Cannot augment module 'setISOWeek' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12470,9): error TS2649: Cannot augment module 'setISOWeekYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12473,9): error TS2649: Cannot augment module 'setMilliseconds' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12476,9): error TS2649: Cannot augment module 'setMinutes' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12479,9): error TS2649: Cannot augment module 'setMonth' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12482,9): error TS2649: Cannot augment module 'setQuarter' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12485,9): error TS2649: Cannot augment module 'setSeconds' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12488,9): error TS2649: Cannot augment module 'setWeek' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12491,9): error TS2649: Cannot augment module 'setWeekWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12503,9): error TS2649: Cannot augment module 'setWeekYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12506,9): error TS2649: Cannot augment module 'setWeekYearWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12518,9): error TS2649: Cannot augment module 'setYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12521,9): error TS2649: Cannot augment module 'startOfDay' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12524,9): error TS2649: Cannot augment module 'startOfDecade' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12527,9): error TS2649: Cannot augment module 'startOfHour' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12530,9): error TS2649: Cannot augment module 'startOfISOWeek' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12533,9): error TS2649: Cannot augment module 'startOfISOWeekYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12536,9): error TS2649: Cannot augment module 'startOfMinute' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12539,9): error TS2649: Cannot augment module 'startOfMonth' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12542,9): error TS2649: Cannot augment module 'startOfQuarter' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12545,9): error TS2649: Cannot augment module 'startOfSecond' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12548,9): error TS2649: Cannot augment module 'startOfWeek' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12551,9): error TS2649: Cannot augment module 'startOfWeekWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12561,9): error TS2649: Cannot augment module 'startOfWeekYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12564,9): error TS2649: Cannot augment module 'startOfWeekYearWithOptions' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12575,9): error TS2649: Cannot augment module 'startOfYear' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12581,9): error TS2649: Cannot augment module 'subBusinessDays' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12584,9): error TS2649: Cannot augment module 'subDays' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12587,9): error TS2649: Cannot augment module 'subHours' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12590,9): error TS2649: Cannot augment module 'subISOWeekYears' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12593,9): error TS2649: Cannot augment module 'subMilliseconds' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12596,9): error TS2649: Cannot augment module 'subMinutes' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12599,9): error TS2649: Cannot augment module 'subMonths' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12602,9): error TS2649: Cannot augment module 'subQuarters' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12605,9): error TS2649: Cannot augment module 'subSeconds' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12608,9): error TS2649: Cannot augment module 'subWeeks' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12611,9): error TS2649: Cannot augment module 'subYears' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(12614,9): error TS2649: Cannot augment module 'toDate' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15685,9): error TS2649: Cannot augment module 'af' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15688,9): error TS2649: Cannot augment module 'ar' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15691,9): error TS2649: Cannot augment module 'arDZ' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15697,9): error TS2649: Cannot augment module 'arSA' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15703,9): error TS2649: Cannot augment module 'be' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15706,9): error TS2649: Cannot augment module 'bg' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15709,9): error TS2649: Cannot augment module 'bn' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15712,9): error TS2649: Cannot augment module 'ca' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15715,9): error TS2649: Cannot augment module 'cs' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15718,9): error TS2649: Cannot augment module 'cy' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15721,9): error TS2649: Cannot augment module 'da' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15724,9): error TS2649: Cannot augment module 'de' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15727,9): error TS2649: Cannot augment module 'el' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15730,9): error TS2649: Cannot augment module 'enAU' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15733,9): error TS2649: Cannot augment module 'enCA' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15736,9): error TS2649: Cannot augment module 'enGB' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15742,9): error TS2649: Cannot augment module 'enUS' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15745,9): error TS2649: Cannot augment module 'eo' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15748,9): error TS2649: Cannot augment module 'es' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15751,9): error TS2649: Cannot augment module 'et' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15757,9): error TS2649: Cannot augment module 'faIR' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15760,9): error TS2649: Cannot augment module 'fi' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15763,9): error TS2649: Cannot augment module 'fil' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15766,9): error TS2649: Cannot augment module 'fr' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.d.ts(15769,9): error TS2649: Cannot augment module 'frCA' with value exports because it resolves to a non-module entity.
node_modules/date-fns/typings.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Environment:
Angular - v8.xx.xx
Node - 10.14.1
Typescript - 3.5.3
TSLint - v5.20.1
Webpack - 4.39.2
I am getting ton of build errors whenever I try to build my Angular application with any imports from
date-fns
and am trying to figure out why. Using and running the application after the build shows that the imports work perfectly, and I can use the functions after in the application. It's just my compiler/linter that seems to be complaining. I do have a bunch of older versions for my environment for compatibility reasons, so not sure if one or a few or these are the issue/s, or if it's an issue with the configurations I have set for the build.Also, are there typings I can possibly import/need to import to resolve these issues?
Here is my code:
And my tsconfig settings:
There are the errors I am getting:
Beta Was this translation helpful? Give feedback.
All reactions