-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Implicit type inclusion changes #9095
Implicit type inclusion changes #9095
Conversation
type: "list", | ||
element: { | ||
name: "typeRoots", | ||
type: "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.
isFilePath: true
🔔 |
// use typesRoot and fallback to directory that contains tsconfig or current directory if typesRoot is not set | ||
const rootDir = options.typesRoot || (options.configFilePath ? getDirectoryPath(options.configFilePath) : (host.getCurrentDirectory && host.getCurrentDirectory())); | ||
|
||
const typeRoots = options.typeRoots || defaultTypeRoots; |
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 make defaultTypeRoots
absolute as well.
We should add a test to |
(oldOptions.configFilePath !== options.configFilePath) || | ||
(oldOptions.baseUrl !== options.baseUrl) || | ||
(oldOptions.typesRoot !== options.typesRoot) || | ||
(oldOptions.typeRoots !== options.typeRoots) || |
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.
arrayIsEqualTo(oldOptions.typeRoots, options.typeRoots)
@@ -178,6 +178,11 @@ namespace ts { | |||
|
|||
const typeReferenceExtensions = [".d.ts"]; | |||
|
|||
function getEffectiveTypeRoots(options: CompilerOptions, host: ModuleResolutionHost) { | |||
return options.typeRoots || | |||
defaultTypeRoots.map(d => combinePaths(options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(), d)); |
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.
ts.map(defaultTypeRoots
one comment. other than that 👍 |
getInferredTypesRoot seems to be big enough, we should add some unit tests for it, just to make sure we captured all the interesting scenarios. this does not have to gate this change though. |
Implements automatic type inclusion per our discussion today