Skip to content

fix(37578): Deprecate variable name AllowQualifedNameInPlaceOfIdentifier #38726

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

Merged
merged 4 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5366,7 +5366,7 @@ namespace ts {

if (expectsIdentifier && chain.length !== 1
&& !context.encounteredError
&& !(context.flags & NodeBuilderFlags.AllowQualifedNameInPlaceOfIdentifier)) {
&& !(context.flags & NodeBuilderFlags.AllowQualifiedNameInPlaceOfIdentifier)) {
context.encounteredError = true;
Copy link
Member

Choose a reason for hiding this comment

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

the new value is the same as the old, so you should replace the old usage instead of adding to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
return createEntityNameFromSymbolChain(chain, chain.length - 1);
Expand Down
6 changes: 4 additions & 2 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3691,7 +3691,9 @@ namespace ts {

// Error handling
AllowThisInObjectLiteral = 1 << 15,
AllowQualifedNameInPlaceOfIdentifier = 1 << 16,
AllowQualifiedNameInPlaceOfIdentifier = 1 << 16,

Choose a reason for hiding this comment

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

In #37578 I asked to deprecate misspelled variable instead of removing it, as it may break backward-compatibility (in linters, etc.)

It was previously done here, for example:

/** @deprecated Use ProjectReferenceCycle_OutputsSkipped instead. */
ProjectReferenceCycle_OutputsSkupped = 4,

What do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, that sounds much better than deleting it. I just updated my code to deprecate it instead.

/** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
AllowQualifedNameInPlaceOfIdentifier = AllowQualifiedNameInPlaceOfIdentifier,
AllowAnonymousIdentifier = 1 << 17,
AllowEmptyUnionOrIntersection = 1 << 18,
AllowEmptyTuple = 1 << 19,
Expand All @@ -3702,7 +3704,7 @@ namespace ts {
AllowNodeModulesRelativePaths = 1 << 26,
/* @internal */ DoNotIncludeSymbolChain = 1 << 27, // Skip looking up and printing an accessible symbol chain

IgnoreErrors = AllowThisInObjectLiteral | AllowQualifedNameInPlaceOfIdentifier | AllowAnonymousIdentifier | AllowEmptyUnionOrIntersection | AllowEmptyTuple | AllowEmptyIndexInfoType | AllowNodeModulesRelativePaths,
IgnoreErrors = AllowThisInObjectLiteral | AllowQualifiedNameInPlaceOfIdentifier | AllowAnonymousIdentifier | AllowEmptyUnionOrIntersection | AllowEmptyTuple | AllowEmptyIndexInfoType | AllowNodeModulesRelativePaths,

// State
InObjectTypeLiteral = 1 << 22,
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,8 @@ declare namespace ts {
UseSingleQuotesForStringLiteralType = 268435456,
NoTypeReduction = 536870912,
AllowThisInObjectLiteral = 32768,
AllowQualifiedNameInPlaceOfIdentifier = 65536,
/** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
AllowQualifedNameInPlaceOfIdentifier = 65536,
AllowAnonymousIdentifier = 131072,
AllowEmptyUnionOrIntersection = 262144,
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,8 @@ declare namespace ts {
UseSingleQuotesForStringLiteralType = 268435456,
NoTypeReduction = 536870912,
AllowThisInObjectLiteral = 32768,
AllowQualifiedNameInPlaceOfIdentifier = 65536,
/** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
AllowQualifedNameInPlaceOfIdentifier = 65536,
AllowAnonymousIdentifier = 131072,
AllowEmptyUnionOrIntersection = 262144,
Expand Down