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

it works , when i use alias in my project.But it occurs an error in ts file. #240

Open
Jax97 opened this issue Jan 6, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Jax97
Copy link

Jax97 commented Jan 6, 2021

// gulpfile.js

gulp
    .src(entry)
    .pipe(alias({ configuration: tsProject.config }))
    .pipe(tsProject())
    .pipe(gulp.dest('./dist'));
// src/server/controllers/index.ts

import IndexController from '@/controllers/IndexController'; // cannot find module “@/controllers/IndexController” or other type declarations
//  src/server/controllers/IndexController.ts

import Koa from 'koa';

export default class IndexController {
  constructor() {}
  async actionIndex(ctx: Koa.Context, next: Koa.Next) {
    const books = new Books();
    const res = await books.getData();
    ctx.body = res;
  }
}

// tsconfig.json

{
  "compilerOptions": {
    "target": "es5" ,
    "module": "commonjs",
    "paths": {
      "@/controllers": ["./src/server/controllers"],
      "@/models": ["./src/server/models"]
    } ,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}

Although the app run normally, I want to resolve the errors in index.ts

@dhkatz
Copy link
Collaborator

dhkatz commented Jan 9, 2021

If you're getting TypeScript errors, this doesn't seem to be an issue with this plugin. TypeScript errors are an issue with your own TypeScript configuration typically.

@gjsoaresc
Copy link

Well, same here... TS is working fine with my files, when I try to build the gulp-ts-alias get too far...
When it has to be '../../' the lib transforms it in '../../../../'

@dhkatz dhkatz self-assigned this Jul 13, 2021
@dhkatz dhkatz added the bug Something isn't working label Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants