ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

Should deprecated fields be optional?

Open husseinhere opened this issue 1 year ago • 1 comments

Given the message:

message Amount {
  Currency currency = 1;
  int64    old_value = 2 [deprecated = true];
  double   value = 3;
}

ts-proto generates:

export interface Amount {
    currency: Currency;
    /** @deprecated */
    oldValue: number;
    value: number;
}

But wouldn't it be a lot nicer if oldValue was defined as oldValue?: number ?

husseinhere avatar Jan 29 '24 02:01 husseinhere

That seems reasonable; if you want to try adding that check here, we could see what happens:

https://github.com/stephenh/ts-proto/blob/main/src/types.ts#L356

stephenh avatar Jan 30 '24 02:01 stephenh

@husseinhere this issue/feature request should be addressed by https://github.com/stephenh/ts-proto/pull/1010 now

tufandevrim avatar Mar 26 '24 12:03 tufandevrim

Closing this out thanks to #1010, thank you @tufandevrim !

stephenh avatar Mar 27 '24 05:03 stephenh