Enderchief / gleam-tools

monorepo for vite-gleam & ts-gleam
MIT License
35 stars 5 forks source link

tsc fails in example project folder #8

Closed UnsolvedCypher closed 7 hours ago

UnsolvedCypher commented 1 week ago

In the example project folder, running tsc produces an error:

➜  example git:(master)  pnpm tsc
src/main.ts:4:31 - error TS2307: Cannot find module './counter.gleam' or its corresponding type declarations.

4 import { setup_counter } from "./counter.gleam";
                                ~~~~~~~~~~~~~~~~~

Found 1 error in src/main.ts:4

I would expect TypeScript not to produce this error, given that ts-gleam tells it how to open .gleam files. Interestingly, I don't see this error in my LSP when opening a file. Please let me know if there is any more information I can provide! And thank you for this incredibly useful package 😄

UnsolvedCypher commented 1 week ago

It turns out it is expected behavior for tsc not to run with the plugin, see https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin .

Enderchief commented 7 hours ago

tsc will not work no matter what since the plugin is just for the LSP to resolve files properly and does not tell the TypeScript compiler anything. The purpose of the plugin is to work with Vite and the vite-gleam plugin which does build *.gleam properly.