In my node.js project, I have successfully implemented a custom mapped type as follows:
export type Mutable<T> = {
-readonly [P in keyof T]: T[P];
};
However, when I tried to add the same code to an Angular 6 project, compilation failed with the following errors:
ERROR in src/assets/scripts/utils.ts(2,5): error TS1131: Property or signature expected.
src/assets/scripts/utils.ts(2,27): error TS1005: ']' expected.
src/assets/scripts/utils.ts(2,28): error TS1005: ';' expected.
src/assets/scripts/utils.ts(14,29): error TS1128: Declaration or statement expected.
src/assets/scripts/utils.ts(3,1): error TS1128: Declaration or statement expected.
I am wondering why this happens and how I can resolve it?
Any insights or solutions would be greatly appreciated!