chbrown / rfc6902

Complete implementation of RFC6902 in TypeScript
https://chbrown.github.io/rfc6902/
322 stars 39 forks source link

String value?! #25

Closed vporoshok closed 6 years ago

vporoshok commented 6 years ago

Why in typescript definitions Operation.value typed as string? By RFC it must be specified as any:

For example: { "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] }

https://tools.ietf.org/html/rfc6902#section-4.1 page 4

chbrown commented 6 years ago

Thanks, you're right, value should have type any for each of AddOperation, ReplaceOperation, and TestOperation!

I'm surprised this hasn't come up before; I guess I (and others) primarily use the library from a JavaScript client, so I hadn't hit that type-checking snag before.

Fixed by 4a62898 and just published v2.2.2 to npm.

vporoshok commented 6 years ago

Thank you! We use Angular4 and TypeScript. A lot of my friends are using TypeScript with React. So it's beginning =)