protocolbuffers / protocolbuffers/protobuf-javascript

Commonjs pb exports do not carry intellisense

Aperta
#18 4 commenti 7 reazioni 1 assegnatario Vedi su GitHub

@lukesandberg ci sta già lavorando.

Dal 9/6/2021.

enhancement good first issue javascript triaged
Lingua principale
JavaScript
Stelle
471
Fork
91
Merge medio
3h 57m
PR unite (30g)
2

Descrizione

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);

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.