protobuf.js version: 6.8.8
D:\Project\skybox\Engine\Monju\Protocol\ProtoBuf\Protocol.d.ts
Error:Error:line (74)TS2693: 'string' only refers to a type, but is being used as a value here.
Error:Error:line (74)TS2531: Object is possibly 'null'.
Error:Error:line (81)TS2304: Cannot find name 'fromObject'.
Error:Error:line (81)TS2552: Cannot find name 'object'. Did you mean 'Object'?
Error:Error:line (89)TS2552: Cannot find name 'toObject'. Did you mean 'Object'?
Error:Error:line (89)TS2552: Cannot find name 'message'. Did you mean 'Message'?
Error:Error:line (89)TS2552: Cannot find name 'options'. Did you mean 'Option'?
Error:Error:line (89)TS2339: Property 'IConversionOptions' does not exist on type 'typeof import("D:/Project/skybox/Engine/Monju/node_modules/protobufjs/index")'.
Error:Error:line (95)TS2552: Cannot find name 'toJSON'. Did you mean 'JSON'?
Error:Error:line (164)TS2693: 'string' only refers to a type, but is being used as a value here.
Error:Error:line (164)TS2531: Object is possibly 'null'.
Error:Error:line (171)TS2304: Cannot find name 'fromObject'.
Error:Error:line (171)TS2552: Cannot find name 'object'. Did you mean 'Object'?
Error:Error:line (179)TS2552: Cannot find name 'toObject'. Did you mean 'Object'?
Error:Error:line (179)TS2552: Cannot find name 'message'. Did you mean 'Message'?
Error:Error:line (179)TS2304: Cannot find name 'options'.
Error:Error:line (179)TS2339: Property 'IConversionOptions' does not exist on type 'typeof import("D:/Project/skybox/Engine/Monju/node_modules/protobufjs/index")'.
Error:Error:line (185)TS2304: Cannot find name 'toJSON'.
Error:Error:line (254)TS2693: 'string' only refers to a type, but is being used as a value here.
Error:Error:line (254)TS2531: Object is possibly 'null'.
Error:Error:line (261)TS2304: Cannot find name 'fromObject'.
Error:Error:line (261)TS2304: Cannot find name 'object'.
Error:Error:line (269)TS2304: Cannot find name 'toObject'.
Error:Error:line (269)TS2304: Cannot find name 'message'.
Error:Error:line (269)TS2304: Cannot find name 'options'.
Error:Error:line (269)TS2339: Property 'IConversionOptions' does not exist on type 'typeof import("D:/Project/skybox/Engine/Monju/node_modules/protobufjs/index")'.
Error:Error:line (275)TS2304: Cannot find name 'toJSON'.
Error:Error:line (74)TS1005: ',' expected.
Error:Error:line (74)TS1003: Identifier expected.
Error:Error:line (74)TS1005: ',' expected.
Error:Error:line (74)TS1109: Expression expected.
Error:Error:line (74)TS1128: Declaration or statement expected.
Error:Error:line (81)TS1128: Declaration or statement expected.
Error:Error:line (81)TS1128: Declaration or statement expected.
Error:Error:line (81)TS1005: ',' expected.
Error:Error:line (81)TS1003: Identifier expected.
Error:Error:line (81)TS1005: '(' expected.
Error:Error:line (81)TS1005: ',' expected.
Error:Error:line (81)TS1005: ')' expected.
Error:Error:line (89)TS1128: Declaration or statement expected.
Error:Error:line (89)TS1128: Declaration or statement expected.
Error:Error:line (89)TS1005: ',' expected.
Error:Error:line (89)TS1109: Expression expected.
Error:Error:line (89)TS1005: ';' expected.
Error:Error:line (89)TS1003: Identifier expected.
Error:Error:line (89)TS1005: '(' expected.
Error:Error:line (95)TS1128: Declaration or statement expected.
Error:Error:line (95)TS1005: ';' expected.
Error:Error:line (95)TS1003: Identifier expected.
Error:Error:line (95)TS1005: '(' expected.
Error:Error:line (96)TS1128: Declaration or statement expected.
Error:Error:line (164)TS1005: ',' expected.
Error:Error:line (164)TS1003: Identifier expected.
Error:Error:line (164)TS1005: ',' expected.
Error:Error:line (164)TS1109: Expression expected.
Error:Error:line (164)TS1128: Declaration or statement expected.
Error:Error:line (171)TS1128: Declaration or statement expected.
Error:Error:line (171)TS1128: Declaration or statement expected.
Error:Error:line (171)TS1005: ',' expected.
Error:Error:line (171)TS1003: Identifier expected.
Error:Error:line (171)TS1005: '(' expected.
Error:Error:line (171)TS1005: ',' expected.
Error:Error:line (171)TS1005: ')' expected.
Error:Error:line (179)TS1128: Declaration or statement expected.
Error:Error:line (179)TS1128: Declaration or statement expected.
Error:Error:line (179)TS1005: ',' expected.
Error:Error:line (179)TS1109: Expression expected.
Error:Error:line (179)TS1005: ';' expected.
Error:Error:line (179)TS1003: Identifier expected.
Error:Error:line (179)TS1005: '(' expected.
Error:Error:line (185)TS1128: Declaration or statement expected.
Error:Error:line (185)TS1005: ';' expected.
Error:Error:line (185)TS1003: Identifier expected.
Error:Error:line (185)TS1005: '(' expected.
Error:Error:line (186)TS1128: Declaration or statement expected.
Error:Error:line (254)TS1005: ',' expected.
Error:Error:line (254)TS1003: Identifier expected.
Error:Error:line (254)TS1005: ',' expected.
Error:Error:line (254)TS1109: Expression expected.
Error:Error:line (254)TS1128: Declaration or statement expected.
Error:Error:line (261)TS1128: Declaration or statement expected.
Error:Error:line (261)TS1128: Declaration or statement expected.
Error:Error:line (261)TS1005: ',' expected.
Error:Error:line (261)TS1003: Identifier expected.
Error:Error:line (261)TS1005: '(' expected.
Error:Error:line (261)TS1005: ',' expected.
Error:Error:line (261)TS1005: ')' expected.
Error:Error:line (269)TS1128: Declaration or statement expected.
Error:Error:line (269)TS1128: Declaration or statement expected.
Error:Error:line (269)TS1005: ',' expected.
Error:Error:line (269)TS1109: Expression expected.
Error:Error:line (269)TS1005: ';' expected.
Error:Error:line (269)TS1003: Identifier expected.
Error:Error:line (269)TS1005: '(' expected.
Error:Error:line (275)TS1128: Declaration or statement expected.
Error:Error:line (275)TS1005: ';' expected.
Error:Error:line (275)TS1003: Identifier expected.
Error:Error:line (275)TS1005: '(' expected.
Error:Error:line (276)TS1128: Declaration or statement expected.
/**
* Verifies a Message message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: [ 'object' ].<string, any>): (string|null);
/**
* Creates a Message message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Message
*/
public static fromObject(object: [ 'object' ].<string, any>): Message;
/**
* Creates a plain object from a Message message. Also converts values to other types if specified.
* @param message Message
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: Message, options?: $protobuf.IConversionOptions): [ 'object' ].<string, any>;
/**
* Converts this Message to JSON.
* @returns JSON object
*/
public toJSON(): [ 'object' ].<string, any>;
I can't imagine why, but it looks like this only happens with Node 12.x (current LTS). Downgrading to 10.x causes it to emit the correct { [k: string]: any } instead of [ 'object' ].<string, any>.
That said, as far as I can tell, replacing all instances of [ 'object' ]. with Record and [ 'Array' ]. with Array seems to be an effective workaround.
It looks like this is caused by jsdoc/jsdoc#1643; the behavior of util.format changed in Node 12. This is fixed in jsdoc 3.6.1, so upgrading to that or later fixes protobufjs.
It looks like this is caused by jsdoc/jsdoc#1643; the behavior of
util.formatchanged in Node 12. This is fixed in jsdoc 3.6.1, so upgrading to that or later fixes protobufjs.
thanks a lot a lot a lot very very much!
npm install protobufjs
This bug also exists after installation
This latest version of the package is 6.88. Please update the installation package
My way
npm install protobuf-typescript -g
pbjs --target static-module ...
pbts --out ...
https://www.npmjs.com/package/protobuf-typescript
https://github.com/wildfire810/protobuf.js
Forked from protobufjs/protobuf.js
Most helpful comment
It looks like this is caused by jsdoc/jsdoc#1643; the behavior of
util.formatchanged in Node 12. This is fixed in jsdoc 3.6.1, so upgrading to that or later fixes protobufjs.