TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

tsconfig paths not work if dir name start with dot.

Open zhongzhong0505 opened this issue 5 years ago • 2 comments

TypeScript Version: 3.7.3

Search Terms:

Code

./.temp/test

export enum Test {
  test
}

The following code does not work

import { Test } from '@temp/test'
paths: {
"@temp/*": [
        "./.temp/*"
      ]
}

Expected behavior: import not error tips. Actual behavior: image

Playground Link:

Related Issues:

zhongzhong0505 avatar Feb 21 '20 07:02 zhongzhong0505

This seems to work perfectly fine. Both when running tsc and ts-node (with tsconfig-paths registered).

However, there is something around how glob works with folders starting with a dot that makes it harder to work with them. The important point might be to have the ./.folder/**/* added to your include section in tsconfig (even though it seems to work without it for me too). Also, you might want to try adding "baseUrl": "." to your tsconfig.

aczekajski avatar Feb 28 '23 05:02 aczekajski

I detected a problem in my project where Storybook configuration files were not being type-checked because they are located in ./.storybook. This solved it for me:

  "include": ["src", ".storybook/**/*"],

johannes-lindgren avatar May 15 '24 21:05 johannes-lindgren