Skip to content

Merge compiler options deep #14178

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

Closed
wants to merge 1 commit into from

Conversation

d4rkr00t
Copy link
Contributor

Hi,
It's probably more conversation starter then actual PR. If you find it useful/appropriate I'll add tests.

The problem:

Imagine that we have such tsconfig.json:

{
    "extends": "./../tsconfig.base",
    "compilerOptions": {
        "declaration": true,
        "lib": ["es2015", "es2016"]
    },
    "include": [ "*.ts" ]
}

And tsconfig.base.json is:

{
    "compilerOptions": {
        "noUnusedLocals": true,
        "noImplicitAny": true,
        "sourceMap": true,
        "target": "es6",
        "lib": ["es5", "dom"]
    }
}

As a result of extending base config we will get compilerOptions which looks like that:

{
    "compilerOptions": {
        "declaration": true,
        "noUnusedLocals": true,
        "noImplicitAny": true,
        "sourceMap": true,
        "target": "es6",
        "lib": ["es2015", "es2016"]
    }
}

As you can see, "lib" now only contains items from tsconfig.json. It means we can't add extra items to libs, we can only completely redeclare them. And i'm not sure if it was intended or not.

The only bad thing with merging "lib" i can think of is it becomes impossible to redeclare them. But probably it's not an issue.

What do you think?

Merge compiler options deep in order to make it possible to inherit
nested params like "lib".
@DanielRosenwasser
Copy link
Member

Well, when we first discussed the idea of the config inheritance (i.e. extends fields in tsconfig.json), there wasn't much discussion, but the decisions were largely unanimous to take the simpler option between merging and overwriting. Check out #10566.

@d4rkr00t
Copy link
Contributor Author

d4rkr00t commented Apr 7, 2017

Yeah, sorry for such late response :) Probably i should close this PR :)

@d4rkr00t d4rkr00t closed this Apr 7, 2017
@d4rkr00t d4rkr00t deleted the merge-compiler-opts branch April 7, 2017 05:41
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants