Skip to content
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

Deprecate properties toString and text of JSDocBlock #721

Merged
merged 3 commits into from
Feb 20, 2024
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
7 changes: 5 additions & 2 deletions packages/protoplugin/src/ecmascript/generated-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { makeImportPathRelative } from "./import-path.js";
import type { JSDocBlock } from "./jsdoc.js";
import { createJsDocBlock } from "./jsdoc.js";
import {
createExportDeclaration,
ExportDeclaration,
LiteralProtoInt64,
LiteralString,
Expand Down Expand Up @@ -227,7 +226,11 @@ export function createGeneratedFile(
return createImportSymbol(name, importPath);
},
exportDecl(declaration, name) {
return createExportDeclaration(declaration, name);
return {
kind: "es_export_decl",
declaration,
name,
};
},
string(string) {
// We do not use LiteralString, which was added later, to maintain backwards compatibility
Expand Down
7 changes: 7 additions & 0 deletions packages/protoplugin/src/ecmascript/jsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ import type { AnyDesc, DescFile } from "@bufbuild/protobuf";

export type JSDocBlock = {
readonly kind: "es_jsdoc";
/**
* @deprecated In a future release, we will make this property optional.
*/
text: string;
indentation?: string;
/**
* @deprecated In a future release, we will remove this method.
*/
toString(): string;
};

// TODO simplify type JSDocBlock to bring it in line with others in opaque-printables.ts
export function createJsDocBlock(
textOrDesc: string | Exclude<AnyDesc, DescFile>,
indentation?: string,
Expand Down
11 changes: 0 additions & 11 deletions packages/protoplugin/src/ecmascript/opaque-printables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,3 @@ export type ExportDeclaration = {
declaration: string;
name: string | DescMessage | DescEnum | DescExtension;
};

export function createExportDeclaration(
declaration: string,
name: ExportDeclaration["name"],
): ExportDeclaration {
return {
kind: "es_export_decl",
declaration,
name,
};
}
Loading