Skip to content

Custom includes from original tsconfig.json #65

@ghost

Description

We're using tsc-files in our pre-commit hook to check the staged files. When running the script, I was getting errors from tsc-files that were related to the Nativewind library, that I wasn't getting when running plain tsc. As it turns out, this was related to the files that we include in the projects tsconfig.json and that some of these includes are also required when running tsc-files.

Since tsc-files just generates an empty array without an option to fill the "includes" section, I created a patch that includes a new field from the tsconfig.json called "tsc-files-include" in the "includes"-Array from the generated tsconfig.json.

Patch:

diff --git a/node_modules/tsc-files/cli.js b/node_modules/tsc-files/cli.js
index 7544d0d..e738637 100755
--- a/node_modules/tsc-files/cli.js
+++ b/node_modules/tsc-files/cli.js
@@ -53,7 +53,7 @@ const tmpTsconfig = {
     skipLibCheck: true,
   },
   files,
-  include: [],
+  include: [...tsconfig['tsc-files-include']],
 }
 fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2))

New field in tsconfig.json:

{
  "include": [
    ...,
    "app.d.ts"
  ],
  "tsc-files-include": [
    "app.d.ts"
  ]
}

Do you think there's a way to provide some kind of configuration option for the values of the "includes"-Array of the generated tsconfig.json?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions