Skip to content

Support for multiple, root-level tsconfigs #51382

Closed

Description

@kylemh

#48189 and #35395 (comment) are really nice new additions, but ones that are incredibly limited by my inability to have VS Code be aware of the fact that some files are using a different TS Config.

Sure, I could use different TS Configs in different folders so findup resolves rules correctly; however, that's not always ideal!Imagine a typical components folder full of folders that house component source code, test files, and maybe Storybook files...

component
        ├── __tests__
        |       └ component.test.tsx
        ├── __stories__
        |       └ component.stories.tsx
        └── component.tsx

Different file suffixes and different contexts ripe for developer experience improvements; however, to actually provide different tsconfig contexts to these files, I'd need:

component
        ├── __tests__
        |       ├ tsconifg.test.json
        |       └ component.test.tsx
        ├── __stories__
        |       ├ tsconifg.stories.json
        |       └ component.stories.tsx
        └── component.tsx

This is untenable. Instead, I wanted to suggest the ability to map multiple TS Configs to VS Code where in-project collisions are checked for (so no 2 tsconfigs read the same file). If there are no collisions, VS Code will choose the correct tsconfig regarding the file in view. If there are collisions, then warn that VS Code isn't certain about which tsconfig.json to use and try to fail the compiler at top-of-file.

Activity

  1. sceurty commented on Oct 28, 2022

    @sceurty

    My team has the same issue.
    We try to co-locate our UI tests with our product code, and each set has its own tsconfig file which cannot be shared.
    I added the jest-expect-message library to be used by our tests but Visual Studio Code keeps showing a type error, even though our external TypeScript type check succeeds.
    After looking at the content of tsserver.log, I can tell Visual Studio Code is using the wrong tsconfig for the test.

  2. removed their assignment
    on Nov 2, 2022
  3. mjbvz commented on Nov 2, 2022

    @mjbvz

    Related #33094

  4. typescript-bot commented on Dec 9, 2022

    @typescript-bot
    Contributor

    This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  5. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions