mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add types for protoc-plugin * Export simplePlugin as a namespace * Remove unused file * Use `require()` syntax in tests
27 lines
719 B
TypeScript
27 lines
719 B
TypeScript
import protocPlugin = require('protoc-plugin');
|
|
import {
|
|
CodeGeneratorResponse as pb_CodeGeneratorResponse
|
|
} from "google-protobuf/google/protobuf/compiler/plugin_pb";
|
|
import FileObject = pb_CodeGeneratorResponse.File.AsObject;
|
|
|
|
const {
|
|
CodeGeneratorRequest,
|
|
CodeGeneratorResponse,
|
|
CodeGeneratorResponseError
|
|
} = protocPlugin;
|
|
|
|
protocPlugin(filesToGenerate => {
|
|
const files: FileObject[] = [];
|
|
files.push({ name: "my_file.ts.d", content: "example" });
|
|
return files;
|
|
});
|
|
|
|
CodeGeneratorRequest()
|
|
.then(req => {
|
|
const files: FileObject[] = [];
|
|
files.push({ name: "my_file.ts.d", content: "example" });
|
|
return files;
|
|
})
|
|
.then(CodeGeneratorResponse())
|
|
.catch(CodeGeneratorResponseError());
|