new package: resolve-protobuf-schema (#36602)

* npx dts-gen --dt --name resolve-protobuf-schema -t module

* drafted types

* npx prettier --write .\types\resolve-protobuf-schema\**

* fixed linting issues
This commit is contained in:
Claas Ahlrichs 2019-07-03 18:33:18 +02:00 committed by Ryan Cavanaugh
parent 93bff1f0f1
commit 24c734b95c
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// Type definitions for resolve-protobuf-schema 2.1
// Project: https://github.com/mafintosh/resolve-protobuf-schema
// Definitions by: Claas Ahlrichs <https://github.com/claasahl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
import { Schema } from 'protocol-buffers-schema/types';
declare namespace ResolveProtobufSchema {
function sync(file: string): Schema;
}
declare function ResolveProtobufSchema(file: string, callback: (error: Error | null, schema?: Schema) => void): void;
export = ResolveProtobufSchema;

View File

@ -0,0 +1,9 @@
import resolve from 'resolve-protobuf-schema';
// resolve.sync(path) sync version of resolve
resolve.sync('./test.proto');
// resolve(path, cb) read and resolve a schema
resolve('./test.proto', (error, schema) => {
// ...
});

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"resolve-protobuf-schema-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }