It seems like you're following the example from the documentation correctly, but you're encountering issues with the types for express. The any type on express() and the middleware variables like req and res suggests that the type definitions are not being applied as expected.
Here are a few steps you can take to troubleshoot this issue:
-
Ensure Correct Type Definitions: Make sure that the version of the type definitions (@types/express) matches the version of express you are importing. Mismatches between versions can sometimes lead to type errors.
-
Check Deno's Cache: Deno caches modules and type definitions. If there was an issue when fetching the types, it might have been cached incorrectly. You can refresh Deno's cache with the following command:
deno cache --reload "npm:[email protected]"
-
Permissions: Ensure that you are providing the necessary permissions when running your Deno script. For networking, you will need the --allow-net flag.
-
Deno Version: Although you are using Deno version 1.44.4, make sure that it is up to date with the latest release that supports npm specifiers, as there might have been fixes or improvements related to npm support.
-
Type Checking: If you are running the script without type checking (using deno run --no-check), try running it with type checking enabled to see if there are any type-related errors that need to be addressed.
-
Import Map: If you are using an import map, ensure that it is correctly configured to map the npm specifiers to the right URLs.
-
Deno Unstable Features: Since npm support in Deno is experimental, you might need to run Deno with the --unstable flag to enable these features.
If you've tried these steps and are still facing