microsoft / microsoft/TypeScript

Allow regular flags to mix with --build

Open
#25,613 14 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 3.0.0-rc, 3.0.0-dev.20180712

Search Terms:

build mode, --build

Code

I have project with the following tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "moduleResolution": "node",
        "target": "es2017",
        "lib": ["es2017"],
        "strict": true,
        "sourceMap": true,
        "noEmitOnError": true,
        "types": ["node"]
    },
    "include": [
        "src/**/*.ts"
    ]
}

and compile it with command:

node_modules/.bin/tsc --build tsconfig.json --outDir out --rootDir /home/kostya/proj/foo

Note, that outDir and rootDir options come from command line arguments, because I want to share output directory for another command (clean).

Expected behavior:

outDir and rootDir options will be took from command line.

Actual behavior:

Compiler ignores this options:

node_modules/.bin/tsc --build tsconfig.json --outDir out --rootDir /home/kostya/proj/foo
message TS6096: File '/home/kostya/proj/foo/--outDir' does not exist.

message TS6096: File '/home/kostya/proj/foo/out' does not exist.

message TS6096: File '/home/kostya/proj/foo/--rootDir' does not exist.

Playground Link:

Related Issues: https://github.com/Microsoft/TypeScript/issues/25600

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported tsc --build tsconfig.json --outDir out --rootDir /home/kostya/proj/foo command and inspect the --build argument parsing entry point. Done means regular flags are accepted as compiler options instead of being treated as project paths, while project paths still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.