Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is recent version of gulp-typescript has bug with 'typeRoots' attribute? #682

Open
keepgo-studio opened this issue May 5, 2023 · 0 comments

Comments

@keepgo-studio
Copy link

I've tried to compileing ts files with custom tsconfig.json that contains typeRoots since I'm using custom types.
But compiling only completed with tsc in manual, not with gulp-typescript...
this issue is literally same as issue #421, but I cannot find solution for year 2023.

I tried change gulp-typescript version(5.0.1), but didn't work either.

and added under code at tsconfig.json, also does not resolve it.

"paths": { 
      "*": ["@types/*"] 
    },

Expected behavior:
works fine as tsc

Actual behavior:

src/app.preload.ts(5,6): error TS2304: Cannot find name 'PreloadAPI'.
TypeScript: 1 semantic error
TypeScript: emit succeeded (with errors)
[02:52:39] 'node' errored after 1.24 s
[02:52:39] Error: TypeScript: Compilation failed
    at Output.mightFinish (/Users/gwonhaesol/Desktop/keepgo-studio/twitch-electron/node_modules/gulp-typescript/release/output.js:130:43)
    at /Users/gwonhaesol/Desktop/keepgo-studio/twitch-electron/node_modules/gulp-typescript/release/output.js:43:22
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[02:52:39] 'build' errored after 1.24 s

Your gulpfile:

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

const gulp = require("gulp");
const ts = require("gulp-typescript");

const nodeProject = ts.createProject("./src/tsconfig.json");

const builds = {
  node: () => gulp
  .src(["src/*.ts"])
  .pipe(nodeProject())
  .pipe(gulp.dest("dist/"))
};

gulp.task("build", gulp.parallel([builds.node]));

tsconfig.json

Include your tsconfig, if related to this issue.

{
  "extends": "./tsconfig.common.json",
  "compilerOptions": {
    "rootDir": ".",
    "baseUrl": ".",
    "outDir": "../dist",
    "module": "CommonJS",
    "typeRoots": [
      "@types"
    ]
  },
  "include": [
    "*.ts",
    "@types/*.d.ts"
  ],
  "exclude": [
    "app/**/*.ts",
    "public/**/*"
  ]
}

Code

Include your TypeScript code, if necessary.

import { contextBridge } from "electron";

contextBridge.exposeInMainWorld('api', {
  version: process.versions.node
} as PreloadAPI);

I've made same example project at https://github.com/iougou03/tests/tree/gulp-typescript-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant