-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat(dts): support dts.alias
#1135
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for a new dts.alias
configuration option that allows configuring path aliases specifically for TypeScript declaration files. The feature enables users to set path aliases that only affect declaration file generation without impacting JavaScript output.
- Adds a new
dts.alias
configuration option of typeRecord<string, string>
- Implements merging logic that combines
dts.alias
withtsconfig.json
paths, withdts.alias
taking higher priority - Updates documentation in both English and Chinese to explain the new feature
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/core/src/types/config.ts | Adds the alias property to the Dts type definition |
packages/core/src/config.ts | Passes the dts.alias option to the DTS plugin configuration |
packages/plugin-dts/src/index.ts | Adds alias parameter to PluginDtsOptions and initializes default value |
packages/plugin-dts/src/dts.ts | Implements the alias merging logic with tsconfig paths |
packages/plugin-dts/src/utils.ts | Adds utility function mergeAliasWithTsConfigPaths for merging aliases |
packages/plugin-dts/src/tsc.ts | Updates function signatures to pass paths through the processing pipeline |
packages/plugin-dts/README.md | Documents the new alias option with usage examples |
website/docs/en/config/lib/dts.mdx | Adds English documentation for the new dts.alias configuration |
website/docs/zh/config/lib/dts.mdx | Adds Chinese documentation for the new dts.alias configuration |
website/docs/en/guide/advanced/dts.mdx | Updates the configuration table to include the new option |
website/docs/zh/guide/advanced/dts.mdx | Updates the configuration table to include the new option |
tests/integration/dts/bundle-false/alias/* | Adds integration test files for the new alias functionality |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
✅ Deploy Preview for rslib ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary
dts.alias
Record<string, string>
{}
Configure the path alias for declaration files.
dts.alias
will be merged withcompilerOptions.paths
configured intsconfig.json
anddts.alias
has a higher priority.In most cases, you don't need to use
dts.alias
, but consider using it when you need to use path alias only in declaration files without wanting to affect JavaScript outputs. For example, map the declaration file offoo
to./compiled/foo
.Related Links
Checklist