ivogabe / gulp-typescript

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

seek help: throw error in compiling,I don't know what to do #653

Open halo951 opened 4 years ago

halo951 commented 4 years ago

Expected behavior:

I want to configure the include option

Actual behavior:

The following errors occur occasionally, and i execute save file,and recompile . this error is disappears.
In this case, I don't know how to configure include

Add: the error occurs only in files that use the import statement

src\mulit\cloud.ts(1,25): error TS6307: File 'D:/workspace/mp/zb-ugg/src/config.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
src\mulit\cloud.ts(2,21): error TS6307: File 'D:/workspace/mp/zb-ugg/src/utils/api.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.
D:/workspace/mp/zb-ugg/src/utils/api.ts(1,34): error TS6307: File 'D:/workspace/mp/zb-ugg/src/utils/wechat-version-diff.ts' is not listed within the file list of project ''. Projects must list all files or use an 'include' pattern.

Your gulpfile:

ts({
   // import tsconfig.compilerOptions 
    "target": "es5",
    "module": "ESNext",
    "lib": ["ESNext", "ES2020"],
    "sourceMap": false,
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    },
    "types": ["miniprogram-api-typings"],
    "tsBuildInfoFile": "./logs/ts.build.log",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": "node",
    "removeComments": true,
    "importHelpers": false,
    "strict": true,
    "strictNullChecks": false,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "allowUmdGlobalAccess": true,
    "forceConsistentCasingInFileNames": true

 });

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "ESNext",
    "lib": ["ESNext", "ES2020"],
    "sourceMap": false,
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    },
    "types": ["miniprogram-api-typings"],
    "tsBuildInfoFile": "./logs/ts.build.log",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": "node",
    "removeComments": true,
    "importHelpers": false,
    "strict": true,
    "strictNullChecks": false,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "allowUmdGlobalAccess": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["./src/*", "./src/**/*", "./templates/**/*"],
  "exclude": ["./src/assets"]
}

Code

Include your TypeScript code, if necessary.

// example for api.ts

import { isVersionSupport } from "@/utils/wechat-version-diff";

export const api:Record<string,any> = {};
halo951 commented 4 years ago

英语不好,望见谅 English is not good. I'm sorry