1

I am trying to import a Node module in the most correct way possible. I would like the line:

import * as pg from "pg"

to work. But right now it raises a:

Cannot find module 'pg' error.

I'm hoping I am missing something simple.


My failing strategy:

  1. npm install pg --save
  2. typings install pg --save
  3. "files": [ "./typings/index.d.ts", in tsconfig.json.

Let me know if you have any advice for my approach.

Michael Pell
  • 1,416
  • 1
  • 14
  • 17

1 Answers1

1

Try this

npm install @types/pg

Then go ahead and import it

import * as pg from "pg"
Edwin Kato
  • 543
  • 3
  • 11