fresh icon indicating copy to clipboard operation
fresh copied to clipboard

ReadableStream.from not supported if a fresh app is a subfolder

Open sergeysolovev opened this issue 2 months ago • 6 comments

I have a fresh app as a folder of bigger project with root deno.jsonc. I used this guide to achieve this: https://fresh.deno.dev/docs/examples/changing-the-src-dir

As a result I can not use ReadableStream.from in other part of my code which has nothing to do with the fresh app. It only works if I do both these changes in my deno.jsonc: 1) Comment out jsx and jsxImportSource in compilerOptions; 2) add folder with fresh app to the “exclude” list.

Apart that it’s a bit unexpected and difficult to find sort of issue, how to actually make it work? Would appreciate any help

sergeysolovev avatar Apr 21 '24 10:04 sergeysolovev

Based on the issue title and the description I tried to guess how you're using ReadableStream.from, but I feel like the description is missing that part. Can you share more about that? How do we reproduce the issue?

marvinhagemeister avatar Apr 21 '24 12:04 marvinhagemeister

Sorry about vague description. By “I can not use” I meant that vscode doesn’t like the “from” word of ReadableStream.from([1, 2, 3]) expression and gives the following info in the tooltip:

Property 'from' does not exist on type '{ new (underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number | undefined; } | undefined): ReadableStream<Uint8Array>; new <R = any>(underlyingSource: UnderlyingDefaultSource<...>, strategy?: QueuingStrategy<...> | undefined): ReadableStream<...>; new <R = any>(underlyingSource?: UnderlyingSourc...'.deno-ts(2339)

The script runs and deno check gives no issues about it. So I guess this issue is related to vscode. Please let me know what else is missing

sergeysolovev avatar Apr 21 '24 12:04 sergeysolovev

If it helps, I shared my deno.jsonc in this issue, it’s still the same.

sergeysolovev avatar Apr 21 '24 13:04 sergeysolovev

Thanks for providing more context. This sounds like it's a type issue. Does removing the tripple slash comments in main.ts and dev.ts help?

marvinhagemeister avatar Apr 22 '24 07:04 marvinhagemeister

Oh I see. I don’t have tripple slash comments in dev.ts. Removing the from main.ts doesn’t help with the issue.

sergeysolovev avatar Apr 22 '24 08:04 sergeysolovev

I think the issue here is that Preact always loads dom types, and Deno LSP does not support different global types in different folders of a project. cc @nayeemrmn

lucacasonato avatar Apr 22 '24 12:04 lucacasonato