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

Rename typingOptions.enableAutoDiscovery to typeAcquisition.enable #12373

Merged
merged 3 commits into from
Nov 23, 2016

Conversation

jramsay
Copy link
Member

@jramsay jramsay commented Nov 19, 2016

Rename typingOptions.enableAutoDiscovery to typeAcquisition.enable

@jramsay
Copy link
Member Author

jramsay commented Nov 19, 2016

// cc: @vladima, @mhegazy. @billti

@@ -996,9 +996,9 @@ namespace ts {
return { options, errors };
}

export function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: TypingOptions, errors: Diagnostic[] } {
export function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: TypeAcquisition, errors: Diagnostic[] } {
Copy link
Contributor

Choose a reason for hiding this comment

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

question to @mhegazy - do we consider this a breaking change since this API was public in 2.0. this is also related to name of section in config file

Copy link
Contributor

Choose a reason for hiding this comment

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

we never documented it intentionally , i would say. so it is a breaking change, but not one that would impact ppl.

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding support for the deprecated API (typingOptions.enableAutoDiscovery) just in case

raw: json,
errors: [createCompilerDiagnostic(Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, [...resolutionStack, resolvedPath].join(" -> "))],
wildcardDirectories: {}
};
}

let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
// typingOptions has been deprecated. Use typeAcquisition instead.
const jsonOptions = json["typeAcquisition"] || json["typingOptions"];
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment that we support typingOptions only for backward compat purposes and should remove it in a couple of releases

basePath: string, errors: Diagnostic[], configFileName?: string): TypeAcquisition {

const options: TypeAcquisition = { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
replaceEnableAutoDiscoveryWithEnable(jsonOptions);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should mangle input argument, user code might rely on properties to exist

// Replace deprecated typingOptions.enableAutoDiscovery with typeAcquisition.enable
export function convertEnableAutoDiscoveryToEnable(typeAcquisition: TypeAcquisition): TypeAcquisition {
// Convert deprecated typingOptions.enableAutoDiscovery to typeAcquisition.enable
const result = typeAcquisition;
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 effectively an alias, so any modifications on result will affect source typeAcquisition object

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.

4 participants