thesayyn / protoc-gen-ts

Compile protocol buffer messages to TypeScript.
MIT License
360 stars 74 forks source link

TSC error with compiler option noUnusedLocals #243

Open finnosdiemitdemo opened 11 months ago

finnosdiemitdemo commented 11 months ago

I have a .proto File with just one enum inside.

syntax = "proto3";

enum Color{
  RED = 0;
  GREEN = 1;
  BLUE = 2;
  YELLOW = 3;
}

The output typescript file always imports the google-protobuf library, even if it's not necessary.

import * as pb_1 from "google-protobuf";
export enum Color {
    RED = 0,
    GREEN = 1,
    BLUE = 2,
    YELLOW = 3
}

With the typescript compiler option noUnusedLocals enabled, the following error occurred: TS6133: 'pb_1' is declared but its value is never read.

It would be nice to add a option to solve this problem

thesayyn commented 11 months ago

This is not an issue anymore. Could you try with https://github.com/thesayyn/protoc-gen-ts/pkgs/npm/protoc-gen-ts/150544246?

graup commented 11 months ago

Hi! Could you push these canary releases to the "real" npm? I couldn't figure out how to install packages from the GitHub registry without authenticating. Or does anyone know how to do that?

I tried setting the registry in .yarnrc.yml

npmScopes:
  thesayyn:
    npmRegistryServer: "https://npm.pkg.github.com"

but getting this error

yarn add @thesayyn/protoc-gen-ts@0.0.0-578f3a0
➤ YN0000: ┌ Resolution step
➤ YN0041: │ @thesayyn/protoc-gen-ts@npm:0.0.0-578f3a0: Invalid authentication (as an anonymous user)
➤ YN0000: └ Completed in 0s 398ms