Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Project references: TS server does not find correct projectΒ #56959

Copy link
Copy link
@OliverJAsh

Description

@OliverJAsh
Issue body actions

πŸ”Ž Search Terms

  • project references
  • tsconfig.json

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about project references.

⏯ Playground Link

No response

πŸ’» Code

Full reduced test case: https://github.com/OliverJAsh/ts-project-references-nested

Contents inlined below.

tsconfig.json:

{
  "compilerOptions": {
    "outDir": "./dist/"
  },
  "references": [
    { "path": "./demos/tsconfig.json" },
    { "path": "./app/tsconfig.json" }
  ]
}

app/tsconfig.json:

{
  "compilerOptions": {
    "composite": true,
    "outDir": "../app-dist/"
  },
  "include": ["**/*"],
  "exclude": ["**/*-demos.*"]
}

app/Component-demos.ts:

// This errors.
import * as helpers from 'demos/helpers';

export const demo = () => {
    helpers;
}

demos/tsconfig.json:

{
  "compilerOptions": {
    "composite": true,
    "rootDir": "../",
    "outDir": "../demos-dist/",
    "paths": {
      "demos/*": ["./*"]
    }
  },
  "include": [
    "**/*",
    "../app/**/*-demos.*"
  ],
  "references": [{ "path": "../app/tsconfig.json" }]
}

demos/helpers.ts:

export const foo = 1;

πŸ™ Actual behavior

When I run tsc --build --verbose tsconfig.json, there are no errors, but when I open my editor (VS Code) and open the file app/Component-demos.ts, I see errors:

image

πŸ™‚ Expected behavior

No errors inside my editor.

Additional information about the issue

When app/Component-demos.ts is opened, I believe TypeScript traverses parent file directories searching for a tsconfig.json file, and it stops at the first file it finds which in this case is app/tsconfig.json. This TS project does not include the file app/Component-demos.ts, so I believe TypeScript should continue traversing parent file directories to search for another tsconfig.json that does include the file. In this case, we want TypeScript to discover the root tsconfig.json.

samhh and tonivj5

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.