Skip to content

Path aliases in tsconfig don't work with vue-tsc #1323

@Darkzarich

Description

@Darkzarich

Hello

I have the following in my tsconfig.json :

{
    "paths": {
      "@/*": ["./src/*"],
      "@@/*" : ["./*"],
      "@public/*" : ["./public/*"],
    },
}

When I just run

vue-tsc --noEmit --skipLibCheck

It works just fine

but I use Husky git hooks to check staged files defined like that

"lint-staged": {
    "*.{vue,ts,tsx}": [
	"vue-tsc --noEmit --skipLibCheck"
    ]
},

When I do git add . & git commit it checks the staged files and fails with the following error:

error TS2307: Cannot find module '@/entities/revision' or its corresponding type declarations.
error TS2307: Cannot find module '@/entities/user' or its corresponding type declarations.
error TS2307: Cannot find module '@/shared/api' or its corresponding type declarations.
error TS2307: Cannot find module '@/shared/lib/errors' or its corresponding type declarations.
error TS2307: Cannot find module '@/shared/ui' or its corresponding type declarations.

It seems that my path aliases are not recognized in this check

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions