Closed tidycode closed 11 months ago
It's not only in empty.ts. It's in any proto message without members. A solution would be to prefix unused variables with _.
Use-case: I've got multiple empty types because I expect to add members in the future.
As timostamm suggested there, generate proto with --ts_opt ts_nocheck.
As timostamm suggested there, generate proto with --ts_opt ts_nocheck.
thanks ,but where is the --ts_opt that I can add? I use buf.gen.yaml
version: v1
plugins:
- plugin: buf.build/community/timostamm-protobuf-ts:v2.9.1
out: ./ts
if run
buf generate --ts_opt ts_nocheck
will throw error: unknown flag: --ts_opt
See the documentation here.
version: v1
plugins:
- plugin: buf.build/community/timostamm-protobuf-ts:v2.9.1
out: ./ts
opt: ts_nocheck
For multiple plugin options, use:
version: v1
plugins:
- plugin: ...
out: ...
opt:
- ts_nocheck
- other_option
opt: ts_nocheck
Many thanks, now it works! empty.ts before
// @generated by protobuf-ts 2.9.1 with parameter ts_nocheck
// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3)
// tslint:disable
......
empty.ts after
// @generated by protobuf-ts 2.9.1 with parameter ts_nocheck
// @generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3)
// tslint:disable
// @ts-nocheck
......
and also thanks @danielvandenberg95 I think https://github.com/timostamm/protobuf-ts/pull/609. is a good PR
This empty.ts was auto generated from protobuf file "google/protobuf/empty.proto" (package "google.protobuf", syntax proto3)
the error is in the function internalBinaryRead
if run script
vue-tsc --noEmit --skipLibCheck
It will cause ts-check error 'reader' is declared but its value is never read. 'length' is declared but its value is never read. 'options' is declared but its value is never read.