From 904cffe2a37290923f40dd24e1c09e01de62c979 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Sun, 19 Jan 2025 09:53:58 -0600 Subject: [PATCH] chore: Update readme to clarify initializeFieldsAsUndefined=false. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index fa8dc7702..616f9a272 100644 --- a/README.markdown +++ b/README.markdown @@ -530,7 +530,7 @@ Generated code will be placed in the Gradle build directory. - With `--ts_proto_opt=useNumericEnumForJson=true`, the JSON converter (`toJSON`) will encode enum values as int, rather than a string literal. -- With `--ts_proto_opt=initializeFieldsAsUndefined=false`, all optional field initializers will be omitted from the generated base instances. +- With `--ts_proto_opt=initializeFieldsAsUndefined=false`, all optional field initializers will be omitted from the generated base instances. This can be useful if you're using Next.js and `getServerSideProps`, see [#492](https://github.com/stephenh/ts-proto/issues/492). The default is `true` to ideally get the best v8 performance by avoiding "changing shapes" as fields are incrementally set. - With `--ts_proto_opt=disableProto2Optionals=true`, all optional fields on proto2 files will not be set to be optional. Please note that this flag is primarily for preserving ts-proto's legacy handling of proto2 files, to avoid breaking changes, and as a result, it is not intended to be used moving forward.