-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Library directives support #7775
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
Conversation
@@ -12,6 +12,12 @@ namespace ts { | |||
|
|||
const emptyArray: any[] = []; | |||
|
|||
const defaultLibrarySearchPaths = <Path[]>[ | |||
"types/", | |||
"node_modules/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to remove this now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cast to Path
- yes, I'll drop it. As for defaultLibrarySearchPaths
- no, they are still used here
@@ -312,9 +312,19 @@ namespace ts { | |||
} | |||
}, | |||
{ | |||
name: "traceModuleResolution", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not a breaking change? Should you flag these as experimental?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this flag was planned to initially appear in 2.0 which was not officially released yes so no, technically it is not a breaking change. There are few folks who might already use this flag, I'll ping them once this PR is approved. Re experimental - I don't think this is applicable here.
👍 |
return options.typesSearchPaths; | ||
} | ||
return options.configFilePath | ||
? [getDirectoryPath(options.configFilePath)].concat(defaultLibrarySearchPaths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need the directory of the tsconfig.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
} | ||
} | ||
|
||
function getEffectiveTypesPrimarySearchPaths(options: CompilerOptions): string[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not think we need the function here. the name is not much simpler than the actual implementation. consider inlining the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
We should also add a new property to tsconfig.json |
No, it should be included |
@@ -2592,7 +2597,7 @@ | |||
"category": "Message", | |||
"code": 6104 | |||
}, | |||
"Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'.": { | |||
"Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not generalize this to take the expected type as well?
…as a root when computing primary locations
👍 |
let skipDefaultLib = options.noLib; | ||
const programDiagnostics = createDiagnosticCollection(); | ||
const currentDirectory = host.getCurrentDirectory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line breaks the optional nature of the host argument
This PR breaks the optional nature of the host argument in |
Oops, good catch! Thanks @jbrantly for noticing this, fix will be out shortly |
This PR continues the work started in #7549