alias icon indicating copy to clipboard operation
alias copied to clipboard

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

Open Jax97 opened this issue 4 years ago • 2 comments

// 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

Jax97 avatar Jan 06 '21 15:01 Jax97

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.

dhkatz avatar Jan 09 '21 12:01 dhkatz

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 '../../../../'

gjsoaresc avatar Feb 21 '21 18:02 gjsoaresc