mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 17:50:07 +08:00
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com> Co-authored-by: Henry Mercer <henrymercer@github.com>
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import * as ts from "typescript";
|
|
import { DescriptorRegistry, EnumDescriptorProto, SymbolTable, TypescriptFile, TypeScriptImports } from "@protobuf-ts/plugin-framework";
|
|
import { CommentGenerator } from "./comment-generator";
|
|
import { Interpreter } from "../interpreter";
|
|
import { GeneratorBase } from "./generator-base";
|
|
export declare class EnumGenerator extends GeneratorBase {
|
|
private readonly options;
|
|
constructor(symbols: SymbolTable, registry: DescriptorRegistry, imports: TypeScriptImports, comments: CommentGenerator, interpreter: Interpreter, options: {});
|
|
/**
|
|
* For the following .proto:
|
|
*
|
|
* ```proto
|
|
* enum MyEnum {
|
|
* ANY = 0;
|
|
* YES = 1;
|
|
* NO = 2;
|
|
* }
|
|
* ```
|
|
*
|
|
* We generate the following enum:
|
|
*
|
|
* ```typescript
|
|
* enum MyEnum {
|
|
* ANY = 0,
|
|
* YES = 1,
|
|
* NO = 2
|
|
* }
|
|
* ```
|
|
*
|
|
* We drop a shared prefix, for example:
|
|
*
|
|
* ```proto
|
|
* enum MyEnum {
|
|
* MY_ENUM_FOO = 0;
|
|
* MY_ENUM_BAR = 1;
|
|
* }
|
|
* ```
|
|
*
|
|
* Becomes:
|
|
*
|
|
* ```typescript
|
|
* enum MyEnum {
|
|
* FOO = 0,
|
|
* BAR = 1,
|
|
* }
|
|
* ```
|
|
*
|
|
*/
|
|
generateEnum(source: TypescriptFile, descriptor: EnumDescriptorProto): ts.EnumDeclaration;
|
|
}
|