protocolbuffers / protocolbuffers/protobuf-javascript

Commonjs pb exports do not carry intellisense

Open
#18 4 comments 7 reactions 1 assignee View on GitHub

@lukesandberg is already working on this.

Since Jun 9, 2021.

enhancement good first issue javascript triaged
Dominant language
JavaScript
Stars
471
Forks
91
Avg merge
3h 57m
Merged PRs (30d)
2

Description

What version of protobuf and what language are you using?
Version: v3.6.1
Language: Javascript

What operating system (Linux, Windows, ...) and version?
Ubuntu 20.04, x86_64

What runtime / compiler are you using (e.g., python version or gcc version)
protoc pre-built compiler

What did you do?
Steps to reproduce the behavior:

  1. Create a sample protoc file, here simple.proto. I took it from this example, modified to "proto3"
  2. Use the compiler to autogen JavaScript code: protoc --js_out=import_style=commonjs,binary:. simple.proto
  3. Use the default export as an object with expected Schema: const Schema = require('./simple_pb');
  4. Attempt to use the expected Class(es) on that object: const test = new Schema.Test1();
  5. See that you do not receive intellisense for the Test1() class, nor for expected operations it's instances

What did you expect to see
Intellisense for the simple_pb operations on the default export.

What did you see instead?
No Intellisense, but the operations themselves do execute (setting values, serialzing to Binary).

I was able to "fix" the issue by changing the last line of the simple_pb.js file. The goog export extension did not work, so I just commented it out and spread the goog and proto objects into module.exports:

module.exports = {...goog, ...proto};
// goog.object.extend(exports, proto);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.