Skip to content

Commit

Permalink
Always Object.defineProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Mar 19, 2023
1 parent 844391b commit 15e724a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/typescript-estree/src/convert.ts
Expand Up @@ -3319,16 +3319,15 @@ export class Converter {
aliasKey: AliasKey,
valueKey: ValueKey,
): Properties & Record<AliasKey, Properties[ValueKey]> {
if (this.options.suppressDeprecatedPropertyWarnings) {
(node as any)[aliasKey] = node[valueKey];
return node as Properties & Record<AliasKey, Properties[ValueKey]>;
}

let warned = false;

Object.defineProperty(node, aliasKey, {
configurable: true,
get(): Properties[typeof valueKey] {
if (this.options.suppressDeprecatedPropertyWarnings) {
(node as any)[aliasKey] = node[valueKey];
}

if (!warned) {
// eslint-disable-next-line no-console
console.warn(
Expand Down

0 comments on commit 15e724a

Please sign in to comment.