After utilizing swagger codgen with the typescript-aurelia template to create API code, I noticed that a significant amount of string literals were being used in the resulting code. Despite encountering errors when running the transpiler tsc from the command line due to this code, the generated JavaScript runs smoothly without any issues.
However, problems arise when incorporating gulp-typescript into larger build tasks as it fails to produce JavaScript files upon encountering the error TS2304: Cannot find name '$' in code similar to the example below:
const url = `${this.basePath}/api/v2/courses/{courseId}`
.replace(`{${'courseId'}}`, encodeURIComponent(String(${params['courseId']})));
I am under the impression that the TypeScript syntax used here is valid; nevertheless, there could be a compiler option available to support string literals and templates which I have yet to discover.
If anyone has insight on how to resolve or avoid these errors, your assistance would be greatly appreciated.