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

Implicit type inclusion changes #9095

Merged
merged 8 commits into from
Jun 13, 2016

Conversation

RyanCavanaugh
Copy link
Member

Implements automatic type inclusion per our discussion today

type: "list",
element: {
name: "typeRoots",
type: "string"
Copy link
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
Member Author

🔔

// 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
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
Contributor

mhegazy commented Jun 13, 2016

We should add a test to reuseProgramStructure.ts

(oldOptions.configFilePath !== options.configFilePath) ||
(oldOptions.baseUrl !== options.baseUrl) ||
(oldOptions.typesRoot !== options.typesRoot) ||
(oldOptions.typeRoots !== options.typeRoots) ||
Copy link
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)

@@ -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));
Copy link
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
Contributor

mhegazy commented Jun 13, 2016

one comment. other than that 👍

@mhegazy
Copy link
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