I have the following code:
index.ts
import express from "express";
import { Uuid } from "./Uuid";
import { UuidGen } from "./Uuid_gen";
const app = express();
const port = process.env.port || 3000;
app.get("/Uuidgen/1/:operatingAgency/:locId?", (request, result) =>
result.send(UuidGen.generateType1Uuid(request.params.operatingAgency, request.params.locId).toString())
);
app.listen(port, () => console.log(`UUID Generator listening on port ${port}`));
Now, when the file is saved with a .ts extension, the TypeScript compiler complains:
Now, when the 'Quick Fix' is applied, this is the resulting code:
app.get("/Uuidgen/1/:operatingAgency/:locId?", (request, result) =>
result.send(UuidGen.generateType1Uuid(request.params.operatingAgency, request.params["locId?"]).toString())
This compiles fine, but the locId parameter is never passed to the callback function and is empty. What can I do? A temporary solution is to change the extension to .js and ensure "checkJs": false in tsconfig.json, but ideally I'd like my entire project in TypeScript.
I have @types/express listed under devDependencies in package.json.

<string>req.query.locIdinstead, but this does not work either. Am I missing something?