Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Stream types have problems being inferred? #53

Open
thequailman opened this issue Mar 8, 2023 · 0 comments
Open

Stream types have problems being inferred? #53

thequailman opened this issue Mar 8, 2023 · 0 comments

Comments

@thequailman
Copy link

thequailman commented Mar 8, 2023

When I define a stream type before using it, I regularly need to typecast the value when using 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.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant