Aze
Aze2w ago

Missing express types

Hey, I'm trying to use deno 1.46.3 with express + @types/express, but it seems the types aren't being applied What can I do?
// @deno-types="@types/express"
import express from "express";

const app = express();
const port = Deno.env.get("APP_PORT") || 3000;

app.get("/:name", (request, response) => {
const name: string = request.params.name;
response.send("Hello " + name);
});

if (import.meta.main) {
app.listen(port, () =>
console.log(`Listening on :${port}`)
);
}
// @deno-types="@types/express"
import express from "express";

const app = express();
const port = Deno.env.get("APP_PORT") || 3000;

app.get("/:name", (request, response) => {
const name: string = request.params.name;
response.send("Hello " + name);
});

if (import.meta.main) {
app.listen(port, () =>
console.log(`Listening on :${port}`)
);
}
No description
4 Replies
bartlomieju
bartlomieju2w ago
Use @deno-types="npm:@types/express"
Aze
Aze2w ago
Is the npm prefix necessary even if I did a deno add npm:@types/express?
bartlomieju
bartlomieju2w ago
My feeling is that it shouldn't but I wanted to help you fix intelligence first
Aze
Aze2w ago
I tried that now and did a deno cache --reload npm:@types/express npm:express, but unfortunately this doesn't seem to work properly. Do you reckon a web framework like oak or hono would work better, since it's uploaded on jsr? I settled on oak now, I consider this solved.