Skip to content

Commit 8f8be5d

Browse files
committed
chore: Document forceLong=bigint. Fixes #745.
1 parent e944e71 commit 8f8be5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.markdown

+3-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ Generated code will be placed in the Gradle build directory.
283283

284284
- With `--ts_proto_opt=forceLong=long`, all 64-bit numbers will be parsed as instances of `Long` (using the [long](https://www.npmjs.com/package/long) library).
285285

286-
Alternatively, if you pass `--ts_proto_opt=forceLong=string`, all 64-bit numbers will be outputted as strings.
286+
With `--ts_proto_opt=forceLong=string`, all 64-bit numbers will be output as strings.
287+
288+
With `--ts_proto_opt=forceLong=bigint`, all 64-bit numbers will be output as `BigInt`s. This option still uses the `long` library to encode/decode internally within `protobuf.js`, but then converts to/from `BigInt`s in the ts-proto-generated code.
287289

288290
The default behavior is `forceLong=number`, which will internally still use the `long` library to encode/decode values on the wire (so you will still see a `util.Long = Long` line in your output), but will convert the `long` values to `number` automatically for you. Note that a runtime error is thrown if, while doing this conversion, a 64-bit value is larger than can be correctly stored as a `number`.
289291

0 commit comments

Comments
 (0)