Open vivekkj123 opened 2 years ago
These warnings occur because e.g. ReadableStreamReaderGenericInitialize
in generic-reader.ts
uses ReadableStream
from readable-stream.ts
, but that file also (indirectly) imports generic-reader.ts
. This is fine because:
ReadableStreamReaderGenericInitialize
only uses the type of ReadableStream
, it doesn't actually need to call that constructor.They don't cause a miscompilation, and the resulting bundle still works fine (as evidenced by the CI passing all the tests).
Now, I do agree that it's better if we can avoid these warnings. Previously that wasn't possible, but nowadays TypeScript has type-only imports (import type { ... } from '...'
) which I think can help Rollup better understand that there isn't actually a circular dependency. I'll see if that would help.
Ah, there are some other non-type-only imports too. 😅
generic-reader.ts
imports ReadableStreamCancel
from readable-stream.ts
default-reader.ts
imports IsReadableStreamLocked
from readable-stream.ts
validators/readable-stream.ts
imports IsReadableStream
from readable-stream.ts
I guess I should move some of these functions out of readable-stream.ts
and into a separate module instead to "break" these cycles. But since it's more of an internal stylistic issue, it's not on the top of my to-do list. I'll get around to it at some point (probably if/when I need to rewrite/restructure that code), but not right now.
Hi, On building this package with rollup, I got errors below,
Any fixes?