czerny czerny - 9 months ago 172
Node.js Question

How to import node module in Typescript without type definitions?

When I try to import node.js module in Typescript like this:

import co = require('co');
import co from 'co';

without providing type definitions, both lines reports same error:

error TS2307: Cannot find module 'co'.

How to import it correctly?


The trick is to use purely JavaScript notation:

const co = require('co');