4 ms·
By the way, you can use the "allOf hack" to put documentation alongside a ref. TypeSpec emits this for common cases like this one: https://typespec.io/playgrou
by bterlson 3y ago
By the way, you can use the "allOf hack" to put documentation alongside a ref. TypeSpec emits this for common cases like this one:
https://typespec.io/playground?c=bW9kZWwgRm9vIHsNCiAgLyoqIHRlc3QgKi%2FED3g6IEJhcjsNCn0NCg0KxixCYXIge30%3D https://typespec.io/playground?c=bW9kZWwgRm9vIHsNCiAgLyoqIHR...
- FourOnTheFloor 3y agoHadn't heard of that, thanks. Does TypeSpec have description fields? I don't think I've seen any in the examples.
- bterlson 3y agoThe playground I posted has a description. They're pulled from JSDoc style comments. You can also use the `@doc` decorator, though that's usually reserved for more advanced cases like when you need string interpolation or something.
- FourOnTheFloor 3y agoThanks. I don't see any in that playground though. Which document are they in? I think I looked in all the ones in the drop-down.
- bterlson 3y agoThe link should load up with a sample I wrote, I think? It does for me anyway! Let me know if you don't see it. But I'll also paste it here: model Foo { /** this is a description */ x: Bar; } /** this is also a description */ model Bar {}
- FourOnTheFloor 3y agoThanks. Never having seen a description in this language, I wouldn't know that the above syntax designated one; it looks like a comment. I also can't find any similar strings in any of the samples in the drop-down list.