TypeScript import doesn't work
steve-taylor opened this issue · comments
I started a new TypeScript project using npm init
and npx tsc --init
, then created the following src/index.ts file:
import {Observable, Property} from 'baconjs';
export function add(a$: Observable<number>, b$: Observable<number>): Property<number> {
return a$.combine(b$, (a, b) => a + b);
}
When I attempt to compile using npx tsc -p .
, I get the following error:
src/index.ts:1:36 - error TS2307: Cannot find module 'baconjs' or its corresponding type declarations.
1 import {Observable, Property} from 'baconjs';
~~~~~~~~~
My bad. I added "moduleResolution": "node"
to tsconfig.json and that fixed the problem.