Issue
TypeScript reports the following error when using strictNullChecks as already reported with #552 but closed without a solution:
node_modules/protobufjs/index.d.ts(1356,14): error TS2417: Class static side 'typeof Root' incorrectly extends base class static side 'typeof Namespace'.
Types of property 'fromJSON' are incompatible.
Type '(json: any, root?: Root | undefined) => Root' is not assignable to type '(name: string, json: { [k: string]: any; }) => Namespace'.
Types of parameters 'root' and 'json' are incompatible.
Type '{ [k: string]: any; }' is not assignable to type 'Root | undefined'.
Type '{ [k: string]: any; }' is not assignable to type 'Root'.
Property 'deferred' is missing in type '{ [k: string]: any; }'.
The definitions are:
export class Namespace extends ReflectionObject {
/**
* Constructs a namespace from JSON.
* @param {string} name Namespace name
* @param {Object.<string,*>} json JSON object
* @returns {Namespace} Created namespace
* @throws {TypeError} If arguments are invalid
*/
static fromJSON(name: string, json: { [k: string]: any }): Namespace;
}
export class Root extends Namespace {
/**
* Loads a JSON definition into a root namespace.
* @param {Object.<string,*>|*} json JSON definition
* @param {Root} [root] Root namespace, defaults to create a new one if omitted
* @returns {Root} Root namespace
*/
static fromJSON(json: ({ [k: string]: any }|any), root?: Root): Root;
}
Versions
protobuf.js version: 6.4.5
typescript version: 2.1.4 (same with [email protected])
Reproduction
npm install [email protected]
npm install [email protected]
echo '{"compilerOptions":{"moduleResolution":"Node", "strictNullChecks":true, "target":"ES6"}}' > tsconfig.json
echo 'import * as protobuf from "protobufjs";' > index.ts
node_modules/.bin/tsc
Issue
TypeScript reports the following error when using
strictNullChecksas already reported with #552 but closed without a solution:The definitions are:
Versions
protobuf.js version:
6.4.5typescript version:
2.1.4(same with[email protected])Reproduction