Skip to content

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

@jramsay jramsay force-pushed the RenameTypingOptions branch from 3bae217 to 5a9451a Compare November 19, 2016 02:14
}

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

@jramsay jramsay force-pushed the RenameTypingOptions branch from 8a52f05 to 70e130b Compare November 22, 2016 02:17
const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
// typingOptions has been deprecated. Use typeAcquisition instead.
const jsonOptions = json["typeAcquisition"] || json["typingOptions"];
const typeAcquisition: TypeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName);
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


const options: TypeAcquisition = { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
replaceEnableAutoDiscoveryWithEnable(jsonOptions);
convertOptionsFromJson(typeAcquisitionDeclarations, jsonOptions, basePath, options, Diagnostics.Unknown_type_acquisition_option_0, errors);
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

@jramsay jramsay force-pushed the RenameTypingOptions branch from ba0a6e9 to a0ec828 Compare November 22, 2016 23:38
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.

5 participants