Skip to content

Implicit type inclusion changes#9095

Merged
RyanCavanaugh merged 8 commits into
microsoft:masterfrom
RyanCavanaugh:implicitTypeReferences
Jun 13, 2016
Merged

Implicit type inclusion changes#9095
RyanCavanaugh merged 8 commits into
microsoft:masterfrom
RyanCavanaugh:implicitTypeReferences

Conversation

@RyanCavanaugh
Copy link
Copy Markdown
Member

Implements automatic type inclusion per our discussion today

Comment thread src/compiler/commandLineParser.ts Outdated
type: "list",
element: {
name: "typeRoots",
type: "string"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isFilePath: true

@RyanCavanaugh
Copy link
Copy Markdown
Member Author

🔔

Comment thread src/compiler/program.ts Outdated
// 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;
Copy link
Copy Markdown
Contributor

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.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 13, 2016

We should add a test to reuseProgramStructure.ts

Comment thread src/compiler/program.ts Outdated
(oldOptions.configFilePath !== options.configFilePath) ||
(oldOptions.baseUrl !== options.baseUrl) ||
(oldOptions.typesRoot !== options.typesRoot) ||
(oldOptions.typeRoots !== options.typeRoots) ||
Copy link
Copy Markdown
Contributor

@mhegazy mhegazy Jun 13, 2016

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)

Comment thread src/compiler/program.ts

function getEffectiveTypeRoots(options: CompilerOptions, host: ModuleResolutionHost) {
return options.typeRoots ||
defaultTypeRoots.map(d => combinePaths(options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(), d));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ts.map(defaultTypeRoots

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 13, 2016

one comment. other than that 👍

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 13, 2016

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.

@RyanCavanaugh RyanCavanaugh merged commit f9923ef into microsoft:master Jun 13, 2016
@RyanCavanaugh RyanCavanaugh deleted the implicitTypeReferences branch June 13, 2016 23:33
@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