I'm currently trying to set up a development environment for a typescript REST consumer and am encountering the following problem: the compiler seems to mind references to Typings when they're placed in the .ts source files, however completely ignores them when I try to manage my refereneces via a single .d.ts file in tsconfig.json.
I'm getting an error TS2307: Cannot find module 'request'. while trying to compile the following code:
import * as request from 'request'; module HTTPClient { ... } This is my tsconfig.json file:
{ "compilerOptions": { "jsx": "react", "module": "commonjs", "noImplicitAny": true, "noEmitOnError": true, "outDir": "./build/", "preserveConstEnums": true, "removeComments": true, "target": "ES5", "declarationFiles": true, "moduleResolution": "classic" }, "exclude": [ "./node_modules", "./build", "./tests" ], "include": [ "./src/ts/**/*", "./typings/main.d.ts" ] } And this is the gulp code I'm using to compile and bundle everything:
var typescriptProject = typescriptCompiler.createProject(project['tsconfig'], { typescript: typescript }); gulp.task( 'compile-ts', function () { return gulp .src([ project['ts'] + '**/*{ts, tsx}' ]) .pipe(typescriptCompiler(typescriptProject)) .js .pipe(gulp.dest(output['js'])); } ); gulp.task( 'bundle-js', function () { return browserify(output['js'] + 'main.js') .bundle() .pipe(source('bundle.js')) .pipe(gulp.dest(output['web'])); } ); I have the ambient definitions for Request installed and referenced in typings/main.d.ts. Could this have something to do with the way I'm using browserify to resolve the modules? Any help would be much appreciated.