Open thequailman opened 1 year ago
When I define a stream type before using it, I regularly need to typecast the value when using stream():
stream()
interface MyType { [index: string]: string | undefined, } let s: Stream<MyType>; s = Stream({ hello: "world", });
This will error, saying it's not assignable to MyType. Typecasting the object (adding } as MyType inside the stream) fixes it.
} as MyType
This works though:
interface MyType { [index: string]: string | undefined, } const s: Stream<MyType> = Stream({ hello: "world", });
This may be a typescript quirk that I'm not aware of. I'm using TypeScript 4.9.5.
When I define a stream type before using it, I regularly need to typecast the value when using
stream()
:This will error, saying it's not assignable to MyType. Typecasting the object (adding
} as MyType
inside the stream) fixes it.This works though:
This may be a typescript quirk that I'm not aware of. I'm using TypeScript 4.9.5.