Skip to content

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

Description

@Jax97
// gulpfile.jsgulp.src(entry).pipe(alias({configuration: tsProject.config})).pipe(tsProject()).pipe(gulp.dest('./dist'));
// src/server/controllers/index.tsimportIndexControllerfrom'@/controllers/IndexController';// cannot find module “@/controllers/IndexController” or other type declarations
// src/server/controllers/IndexController.tsimportKoafrom'koa';exportdefaultclassIndexController{constructor(){}asyncactionIndex(ctx: Koa.Context,next: Koa.Next){constbooks=newBooks();constres=awaitbooks.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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions