Skip to content

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

@dhorkin

Description

@dhorkin

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)

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