Skip to content

More precise descriptions of project reference-related editor options. #3384

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

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

DanielRosenwasser
Copy link
Member

No description provided.

@jakebailey jakebailey added the deploy-preview Enables automatic deployments to preview environments on a PR label May 7, 2025
Copy link
Contributor

github-actions bot commented May 8, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3384.centralus.5.azurestaticapps.net

@@ -1,7 +1,49 @@
---
display: "Disable Source Project Reference Redirect"
oneline: "Disable preferring source files instead of declaration files when referencing composite projects."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the onelines come from the CLI flag descriptions, if that matters to you.

@@ -465,7 +465,7 @@ tsc app.ts util.ts --target esnext --outfile index.js
</td>
</tr>
<tr class="option-description odd"><td colspan="3">
<p>Reduce the number of projects loaded automatically by TypeScript.</p>
<p>Avoid searching for symbols across referenced projects in code editors.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also stops loading reference projects and looking up in it for default project for file.

Comment on lines +42 to +43
we don't want to stop what we're doing and build `projectB` before we can get accurate errors in `projectA`, so TypeScript prefers reading source `.ts` files instead of generated `.d.ts` files if they're around.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always get source file even if project is not yet built and hence no d.ts file

In larger codebases, this extra work can feel very slow.

The `disableSourceOfProjectReferenceRedirect` option allows developers to opt out of loading source files over declaration files in the editor ([just as it worked before TypeScript 3.7](/docs/handbook/release-notes/typescript-3-7.html#build-free-editing-with-project-references)).
As a result, dependencies will need to be build with declaration files in order to get accurate error-checking, code completion, and other editor features in a project with references.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with declarationMap if you want the definition to jump to original source file instead of d.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-preview Enables automatic deployments to preview environments on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants