Skip to content

Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmedΒ #64618

Description

@auvred

πŸ”Ž Search Terms

CLI, compilerOptions, whitespace, comma

πŸ•— Version & Regression Information

Checked on the latest main

⏯ Playground Link

No response

πŸ’» Code

> npx tsc --showConfig --customConditions "a, b" --types "a, b" --typeRoots "a, b" --moduleSuffixes "a, b" --excludeDirectories "a, b" --excludeFiles "a, b" --lib "es2015, dom" index.ts

πŸ™ Actual behavior

{
    "compilerOptions": {
        "customConditions": [
            "a",
            " b"
        ],
        "lib": [
            "es6",
            "dom"
        ],
        "moduleSuffixes": [
            "a",
            " b"
        ],
        "typeRoots": [
            "./a",
            "./ b"
        ],
        "types": [
            "a",
            " b"
        ]
    },
    "files": [
        "./index.ts"
    ]
}

See space before b in resolved config, and also note that lib values are trimmed correctly

πŸ™‚ Expected behavior

{
    "compilerOptions": {
        "customConditions": [
            "a",
            "b"
        ],
        "lib": [
            "es6",
            "dom"
        ],
        "moduleSuffixes": [
            "a",
            "b"
        ],
        "typeRoots": [
            "./a",
            "./b"
        ],
        "types": [
            "a",
            "b"
        ]
    },
    "files": [
        "./index.ts"
    ]
}

Non-enum options should be whitespace-trimmed as well

Additional information about the issue

Followup for #64522 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions