0

I am trying to add the below line of code in an index.ts file: import express, { Application } from 'express';

But "from 'express'" was showing an error so I ran npm i @types/express -D which resolved the error on that side but created an error for "import express" now

The error I see is TS1259 but I cannot figure out what I should do to remove the error Why would import express show an error when running @types/express and what can I do to solve it

I tried import express = require ('express') - but did not sort it

I can tell you as well that the folder node_modules is not visible in the project in visual studio. However is visible in the folder on my c drive

package.json is fine and shows correctly express

Thanks for the help

1

1 Answer 1

0

This should works:

    import { Application } from 'express';
    import express = require('express');

    const app: Application = express();
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much - it worked. Appreciate it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.