Skip to content
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

tsc-files does not work with composite projects / --build flag does not work #64

Open
FFdhorkin opened this issue Oct 19, 2023 · 2 comments

Comments

@FFdhorkin
Copy link

FFdhorkin commented Oct 19, 2023

I have a composite typescript project; according to the docs, you need to add -b/--build to your tsc args in order to build this.

However, tsc-files does not work with this flag.

My root package.json has this:

{
    "lint-staged": {
        "*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}": [
            "tsc-files --build",
            "eslint --cache --ignore-path .gitignore ${ESLINT_FIX:-}"
        ]
    }
}

which results in this error:

error TS6369: Option '--build' must be the first command line argument.

Originally, I had tsc-files --noEmit there, but that doesn't work with composite projects; it causes these type of errors:

error TS6305: Output file '/repo/path/dist/foo.d.ts' has not been built from source file '/repo/path/src/foo.ts'.
The file is in the program because:
Part of 'files' list in tsconfig.json

But it's not actually in the files list of the tsconfig.json, meaning that tsc-files is the origin of that error, too. Since the TS docs say composite requires you to have emit turned on, that's probably the issue there. (That said, removing --noEmit results in the same errors)

@gustavopch
Copy link
Owner

For composite projects, I suggest you to use incremental build instead of tsc-files: https://www.typescriptlang.org/tsconfig/incremental.html

@FFdhorkin
Copy link
Author

FFdhorkin commented Oct 20, 2023

I only switched the project from a single project to composite this week, because one library required CommonJS. Compiling the original project w/ tsc & incremental is noticably slower than the tsc-files version was :/ (we previously had incremental turned on, but I'm not sure whether tsc-files actually does incremental)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants