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

TSConfig to support glob typeRoots #14979

Closed
maraisr opened this issue Apr 3, 2017 · 5 comments
Closed

TSConfig to support glob typeRoots #14979

maraisr opened this issue Apr 3, 2017 · 5 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript

Comments

@maraisr
Copy link
Member

maraisr commented Apr 3, 2017

So I have my typescript config file coming from a sub-module, and various of other internal packages being git submoduled in, each supplying its own types.

Without specifying each one of them explicitly, is there a possibility to go something like this:

My reason for this is - we have 4 teams sub moulding in what package they want (rather than use NPM, don't ask...), and would hate for the developer to have to add the line of config into the json file considering it comes from another sub-module.

{
    "compilerOptions": {
        "typeRoots": [
            "lib/**/node_modules/@types/"
        ]
    }
}

rather than going:

{
    "compilerOptions": {
        "typeRoots": [
            "lib/core/node_modules/@types/",
            "lib/tools/node_modules/@types/"
            "lib/utils/mock/node_modules/@types/",
            "lib/utils/query/node_modules/@types/"
        ]
    }
}

I get that maybe there might be some overlap in type def's but maybe do something cute whereby it'll pick the first def it finds, and ignore the rest?

@aluanhaddad
Copy link
Contributor

aluanhaddad commented Apr 3, 2017

Its best to be explicit about this kind of thing. In my opinion the compiler is already far too eager to traverse an entire disk drive (following the very bad example set by the NodeJS require algorithm) to pull in anything with a name that matches, ignoring versions and manifests.
If you use any of the same dependencies as these teams, for example if you use moment.js or core-js, and even more so if you are using different package managers (nothing wrong with that by the way😛), there is a high probability of version conflicts and duplicated type declarations.

@maraisr
Copy link
Member Author

maraisr commented Apr 3, 2017

@aluanhaddad really its convention over configuration.

I'm not asking this to be supported natively, more so if there was a way to get it done.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2017

typeRoots is rather an advanced feature. that and the limited number of these folder, suggest that this can be left to humans to figure out, and does not need to be done by the compiler.

@mhegazy mhegazy added Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript labels Apr 27, 2017
@mhegazy mhegazy closed this as completed Apr 27, 2017
@maraisr
Copy link
Member Author

maraisr commented Apr 27, 2017

Fair enough @mhegazy appreciate you having taken the time. Once again love your work, and the rest of the TypeScript's team! ❤️

@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2017

thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants