I'm quite new to Typescript; in fact, I'm trying to get someone else's (old) Typescript code working and I have limited information to go on. Basically, two parts of a web site (i.e., an API and a front-end) are running in two separate Docker containers.
With some knowledge of Docker (i.e., docker compose up) and almost no knowledge of Typescript (I'm not a web developer; more Python/C), I've made some progress but I am stuck with this error message:
1.206 yarn run v1.22.19
1.231 $ cross-env NODE_ENV=production react-scripts build
2.237 Creating an optimized production build...
40.02 Failed to compile.
40.02
40.02 /app/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index.d.ts
40.02 TypeScript error in /app/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index.d.ts(3289,50):
40.02 Type expected. TS1110
40.02
40.02 3287 | | "transaction-currency"
40.02 3288 | | "username";
40.02 > 3289 | type OptionalPrefixToken<T extends string> = `${T} ` | "";
40.02 | ^
40.02 3290 | type OptionalPostfixToken<T extends string> = ` ${T}` | "";
40.02 3291 | type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`;
40.02 3292 | type AutoFillSection = `section-${string}`;
40.02
40.02
40.09 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
40.09 error Command failed with exit code 1.
------
failed to solve: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
The code I am trying to get working seems old. In the package.json, I see "typescript" is at version 3.9.7 . Unfortunately, upgrading it is currently not possible since I don't have the expertise to. It is possible if I have this working, that maybe upgrading will be the next step. But first, I need to get this working.
I looked around Stackoverflow and came across this page. While it is a different package, I guess the cause is the same. Possibly a conflict with an old compiler with new code. So, I thought the solution might be to go back to an older version of this code. Thus, I added this into package.json:
"resolutions": {
"@types/react-dom": "17.0.0"
}
(I picked 17.0.0 based on what version of react-dom existed back when Typescript was 3.9.7 -- which was about 4 years ago.)
This didn't work. But I wonder if this is what I should be doing or should I be trying something else? I'm sort of going around this blind. Any help or guidance would be appreciated! Thank you!