Exploring Shortcut Declarations
When working with TypeScript, I often take a shortcut when declaring object shapes. Instead of creating an interface first and then specifying that the object conforms to that type, I simply do:
object: { fizz: boolean, buzz: boolean } = { fizz: false, buzz: true }
This approach makes sense to me in terms of reducing code length, especially for objects that are only used once.
Pondering about RxJS Observable
Is there a way to define an object shape for an RxJS Observable in a similar concise manner? I was thinking it could look like:
public getBazz(): Observable<{ fizz: boolean, buzz: boolean }> { ... }
However, TypeScript seems to have issues with this specific format, and I am unsure of the correct syntax.