-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
TypeScript paths are not resolved in definition files #32999
Comments
This is the intended behavior. TypeScript's golden rule about How you want to fix this really depends on why you wrote it as |
As an aside: While I agree with this approach on the whole, it is a problem specifically for file extensions: TS understands extensionless imports, but not all environments do. e.g. I believe Deno requires an extension, as do browsers, and there's no way to deal with this discrepancy on the TS side-- |
A nice default I use for projects is set
vs
When using absolute paths in a library which is intended to be hosted in npm, the absolute paths no longer register as the application is compiled into a different folder. Should I set my |
You shouldn't use |
Oh. So what is the intended use case for paths? |
It’s not an aliasing feature, sadly. |
That's a bummer. Does the TS team have any plans to introduce an |
Most likely not: #31643 (comment) |
For the record, your use case--sometimes wanting to use a rooted path instead of multiple levels of |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
6 similar comments
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Thumb up if you used |
TypeScript Versions:
3.5.3
and3.7.0-dev.20190820
Search Terms:
typescript paths remain after compile in type definition files
Code
index.ts
b.ts
tsconfig.json
Expected behavior:
/dist/index.d.ts
Actual behavior:
/dist/index.d.ts
More Info:
My package.json has
When someone imports the package, the types are broken because the paths don't resolve to the expected files.
Perhaps I am approaching this incorrectly. Is there an alternative method to deal with path resolution?
The text was updated successfully, but these errors were encountered: