From 72f413cea0fa8b98948f9608bb7a113070c7733f Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:28:07 -0700 Subject: [PATCH] Remove deprecated originalKeywordKind and isInJSDocNamespace (#58228) --- .../5.0/identifierProperties.ts | 51 ------------------- src/deprecatedCompat/_namespaces/ts.ts | 1 - src/harness/harnessUtils.ts | 4 -- tests/baselines/reference/api/typescript.d.ts | 6 --- 4 files changed, 62 deletions(-) delete mode 100644 src/deprecatedCompat/5.0/identifierProperties.ts diff --git a/src/deprecatedCompat/5.0/identifierProperties.ts b/src/deprecatedCompat/5.0/identifierProperties.ts deleted file mode 100644 index d75ef8ef1a8..00000000000 --- a/src/deprecatedCompat/5.0/identifierProperties.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - addObjectAllocatorPatcher, - hasProperty, - Identifier, - identifierToKeywordKind, - NodeFlags, -} from "../_namespaces/ts"; -import { deprecate } from "../deprecate"; - -declare module "../../compiler/types" { - export interface Identifier { - /** @deprecated Use `idKeyword(identifier)` instead. */ - readonly originalKeywordKind?: SyntaxKind; - - /** @deprecated Use `.parent` or the surrounding context to determine this instead. */ - readonly isInJSDocNamespace?: boolean; - } -} - -addObjectAllocatorPatcher(objectAllocator => { - const Identifier = objectAllocator.getIdentifierConstructor(); - - if (!hasProperty(Identifier.prototype, "originalKeywordKind")) { - Object.defineProperty(Identifier.prototype, "originalKeywordKind", { - get: deprecate(function (this: Identifier) { - return identifierToKeywordKind(this); - }, { - name: "originalKeywordKind", - since: "5.0", - warnAfter: "5.1", - errorAfter: "5.2", - message: "Use 'identifierToKeywordKind(identifier)' instead.", - }), - }); - } - - if (!hasProperty(Identifier.prototype, "isInJSDocNamespace")) { - Object.defineProperty(Identifier.prototype, "isInJSDocNamespace", { - get: deprecate(function (this: Identifier) { - // NOTE: Returns `true` or `undefined` to match previous possible values. - return this.flags & NodeFlags.IdentifierIsInJSDocNamespace ? true : undefined; - }, { - name: "isInJSDocNamespace", - since: "5.0", - warnAfter: "5.1", - errorAfter: "5.2", - message: "Use '.parent' or the surrounding context to determine this instead.", - }), - }); - } -}); diff --git a/src/deprecatedCompat/_namespaces/ts.ts b/src/deprecatedCompat/_namespaces/ts.ts index 637e61365be..cbfc88edbb6 100644 --- a/src/deprecatedCompat/_namespaces/ts.ts +++ b/src/deprecatedCompat/_namespaces/ts.ts @@ -2,4 +2,3 @@ export * from "../../compiler/_namespaces/ts"; export * from "../deprecations"; -export * from "../5.0/identifierProperties"; diff --git a/src/harness/harnessUtils.ts b/src/harness/harnessUtils.ts index 3c1ea660aa0..cb335891e89 100644 --- a/src/harness/harnessUtils.ts +++ b/src/harness/harnessUtils.ts @@ -205,10 +205,6 @@ export function sourceFileToJSON(file: ts.Node): string { } break; - case "originalKeywordKind": - o[propertyName] = getKindName((n as any)[propertyName]); - break; - case "flags": // Clear the flags that are produced by aggregating child values. That is ephemeral // data we don't care about in the dump. We only care what the parser set directly diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index ad1b05ed05e..3fa0b1c9116 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4378,12 +4378,6 @@ declare namespace ts { interface Identifier { readonly text: string; } - interface Identifier { - /** @deprecated Use `idKeyword(identifier)` instead. */ - readonly originalKeywordKind?: SyntaxKind; - /** @deprecated Use `.parent` or the surrounding context to determine this instead. */ - readonly isInJSDocNamespace?: boolean; - } interface TransientIdentifier extends Identifier { resolvedSymbol: Symbol; }