Search code examples
typescriptcommonjs

Typescript compiler not discovering NPM modules in sibling node_modules folder


I'm having some difficulty getting the typescript compiler to find NPM modules that are correctly installed (by usual JS standards). For instance, I have the following imports in my main app:

import { run } from '@cycle/core';

import Rx from 'rx';

import { domDriver, layout } from './html';

import { httpDriver, loadStateRequest, loadStateResponse } from './http';

In my editor, rx and @cycle/core have the trademark red squiggles, and indeed the code fails to compile (FWIW, using browserify/tsify, although that would not explain the editor plugin complaining).

I'm quite sure this is just a naive stupidity on my part, but I'm entirely stumped nevertheless and google isn't helping me.


Solution

  • Use typings. It allows you get get typings for modules that you use. They have typings for rx. You will have to create typings by hand for @cycle/core or just make it be any.