Skip to content

Error when compiling with gulp-typescript. #564

Closed
@mirthlaj

Description

@mirthlaj

When compiling with gulp-typescript I get an error.
With tsc everything works as expected and no errors are shown.

I am using [email protected] and I also tried version 3.0.2 as suggested here ##421.

Expected behavior:
compiled typescript files
Actual behavior:

[18:20:21] Starting 'default'...
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(468,33): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(468,72): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,39): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,69): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,107): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/src/routes/root.ts(3,7): error TS4023: Exported variable 'router' has or is using name 'Router' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
D:/Code/NodeJS/typescript-template/src/routes/users.ts(3,7): error TS4023: Exported variable 'router' has or is using name 'Router' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
D:/Code/NodeJS/typescript-template/src/server.ts(6,7): error TS4023: Exported variable 'app' has or is using name 'Express' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
TypeScript: 5 semantic errors
TypeScript: 3 declaration errors
TypeScript: 3 emit errors
TypeScript: emit failed
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(468,33): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(468,72): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,39): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,69): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/@types/bluebird/index.d.ts(747,107): error TS2304: Cannot find name 'Map'.
D:/Code/NodeJS/typescript-template/node_modules/pg-promise/typescript/pg-promise.d.ts(5,27): error TS2497: Module '"D:/Code/NodeJS/typescript-template/node_modules/pg-promise/typescript/ext-promise"' resolves to a non-module entity and cannot be imported using this construct.
src\routes\root.ts(3,7): error TS4023: Exported variable 'router' has or is using name 'Router' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
src\routes\users.ts(3,7): error TS4023: Exported variable 'router' has or is using name 'Router' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
src\server.ts(6,7): error TS4023: Exported variable 'app' has or is using name 'Express' from external module "D:/Code/NodeJS/typescript-template/node_modules/@types/express-serve-static-core/index" but cannot be named.
TypeScript: 6 semantic errors
TypeScript: 3 declaration errors
TypeScript: 3 emit errors
TypeScript: emit failed
[18:20:36] Finished 'default' after 15 s

Your gulpfile:

gulp.task('default', () => {
	var src = gulp
		.src(['./src/**/*.ts'])
		.pipe($.typescript({
			declaration: true
		}));
		
	var test = gulp	
		.src(['./test/**/*.ts'])
		.pipe($.typescript({
			declaration: true
		}));
		
	return merge([
		src.pipe(gulp.dest('output/src')),
		test.pipe(gulp.dest('output/test'))
	])
});

Include your gulpfile, or only the related task (with ts.createProject).

tsconfig.json
Include your tsconfig, if related to this issue.

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "sourceMap": true,
        "outDir": "output"
    },
    "include": [
        "src/**/*",
        "test/**/*"
    ]
}

Code

Include your TypeScript code, if necessary.

const router = express.Router();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions