Skip to content

Unclear role of the different tsconfig files #31800

Open
@jvskriubakken

Description

@jvskriubakken

Documentation issue

  • Reporting a typo
  • Reporting a documentation bug
  • Documentation improvement
  • Documentation feedback

Is there a specific documentation page you are reporting?

https://nx.dev/technologies/typescript/introduction

Additional context or description

As I use Typescript and React in my monorepo it's natural to visit doc section "Technology / Typescript".

Since I use Typescript I think it's then necessary to add the @nx/js plugin to my nx repo. But it's unclear to me. I use vite for building the TS apps. I lost type checking in my repo after migrating to using Project Crystal, and see that that the @nx/js plugin offers typechecking which I sorely miss.

My repo only needs to build apps, but all my libs are now also built. Is that needed to catch compilation errors? Should I disable build of libs as long as I only deploy apps.

In https://nx.dev/technologies/typescript/introduction#disable-typechecking
it gives an example of disabling typechecking for a single lib by setting addTypecheckTarget: false in tsconfig.json. But I thought tsconfig.json was only for editor and that nx (@nx/js/typescript plugin) uses tsconfig.lib.json?

I have added my own global sync mechanism. Which I want to run using nx sync command. However this triggers sync mechanism in @nx/js plugin. That's fine. But that requires a tsconfig.json to be created at root. OK. I create a empty one with the references array. Then nx sync works. OK. I think typsescript-sync sounds good. Sure good to have, until I read the fine text . It's about syncing TS Project References that I dont use in this repo. You can say: You should have read the fine text. But the same page says also "Schema for internal use only" - so don't bother.

Suggestion: @nx/js-typescript-sync should not require any tsconfig.json at root as long as it does'nt resolve that TS Project References is in use. Maybe it could have inspect tsconfig.base.json first for that?

Second: tsconfig.json for nx to use? I thought tsconfig.json was read by editors and that nx "only used" tsconfig.[something].json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions