Remove deprecated originalKeywordKind and isInJSDocNamespace (#58228)

This commit is contained in:
Jake Bailey 2024-04-17 15:28:07 -07:00 committed by GitHub
parent 23e99c2b76
commit 72f413cea0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 62 deletions

View File

@ -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.",
}),
});
}
});

View File

@ -2,4 +2,3 @@
export * from "../../compiler/_namespaces/ts";
export * from "../deprecations";
export * from "../5.0/identifierProperties";

View File

@ -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

View File

@ -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;
}