ivogabe / gulp-typescript

A TypeScript compiler for gulp with incremental compilation support.
MIT License
839 stars 129 forks source link

can't find moudle but .d.ts file has already exist when target option above es5 #614

Closed Akimotorakiyu closed 5 years ago

Akimotorakiyu commented 5 years ago

can't find moudle but .d.ts file has already exist when target option above es5

Expected behavior: no error Actual behavior: 图片

Your gulpfile:

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

import * as  gulp from "gulp"
import * as rename from "gulp-rename"
import * as stylus from "gulp-stylus"
import * as plumber from "gulp-plumber"

import * as autoprefixer from "autoprefixer"
import * as postcss from "gulp-postcss"

import * as ts from "gulp-typescript"
import { FSWatcher } from "fs";

let tsProject = ts.createProject("tsconfig.json");

function acss(done) {
    gulp.src(`src/**/*.styl`)
        .pipe(plumber())
        .pipe(stylus())
        .pipe(postcss([autoprefixer()]))
        .pipe(rename({
            extname: '.acss',
        }))
        .pipe(gulp.dest("src"));
    done();
}

function tsc(done) {
    gulp.src(`src/**/*.ts`)
        .pipe(tsProject())
        .js
        .pipe(gulp.dest("src"));
    done();
}

console.log("starting gulp task...")
gulp.task("default", gulp.parallel(acss, tsc))

console.log("starting watching...")

let watcher = <FSWatcher[]>[]

watcher.push(gulp.watch(`src/**/*.styl`, acss))
watcher.push(gulp.watch(`src/**/*.ts`, tsc))

watcher.forEach((ele) => {
    ele.on("change", (fileName, eventType) => {
        console.log(`${fileName} changed...`)
    })
})

tsconfig.json

Include your tsconfig, if related to this issue.

    {
    "compilerOptions": {
        "target": "es2017",
        "lib": ["es2017", "dom"],
        "allowUnusedLabels": true,
    },
}
Akimotorakiyu commented 5 years ago

https://github.com/microsoft/TypeScript/issues/31405