Skip to content

Commit d9634d2

Browse files
committed
README: TypeScript example [ci skip]
1 parent 926905b commit d9634d2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ var message = AwesomeMessage.decode(buffer);
160160

161161
Custom classes are automatically populated with static `encode`, `encodeDelimited`, `decode`, `decodeDelimited` and `verify` methods and reference their reflected type via the `$type` property. Note that there are no methods (just `$type`) on instances by default as method names might conflict with field names.
162162

163+
### Usage with TypeScript
164+
165+
```ts
166+
/// <reference path="node_modules/protobufjs/types/protobuf.js.d.ts" />
167+
168+
import * as protobuf from "protobufjs";
169+
...
170+
```
171+
163172
Module Structure
164173
----------------
165174
The library exports a flat `protobuf` namespace with the following members, ordered by category:

0 commit comments

Comments
 (0)