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

Support reference library directives #7549

Closed

Conversation

RyanCavanaugh
Copy link
Member

Implements #7156. I'll update that issue with a more detailed design description


function getEffectiveLibraryPrimarySearchPaths() {
return options.librarySearchPaths ||
(options.configFilePath ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... so if the user provides librarySearchPaths, they effectively override all 3 of the defaults?

Also, why is the configFilePath added to the front? Does this mean if I have my tsconfig file in my ./src project root, an it tries to load a jquery typing, it will first look for ./src/jquery/ (and see if there is a package.json with a typing field)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

I removed "" from the list of default search paths.

@RyanCavanaugh
Copy link
Member Author

Anyone else care to take a look?

@@ -2155,6 +2155,11 @@
"category": "Error",
"code": 4082
},
"Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to a local typings folder to resolve this conflict.": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, missing quotes: .. local 'typings' folder ..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly: Copy the correct file to the local 'typings' folder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to suggested text

(options.rootDir && ts.toPath(options.rootDir, currentDirectory, host.getCanonicalFileName)) ||
(options.configFilePath && getDirectoryPath(getNormalizedAbsolutePath(options.configFilePath, currentDirectory)));
if (libraryRoot === undefined) {
libraryRoot = computeCommonSourceDirectoryOfFilenames(rootNames);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda unexpected. so tsc a.ts will result in a different search location from tsc a\a.ts b\b.ts, even if a.ts has a reference to b.ts?
I would say make it an error to try to resolve a library reference, without a root, and ask the user to specify rootDir.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 10, 2016

closing in favor of #7775

@mhegazy mhegazy closed this Apr 10, 2016
@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.

5 participants