specta-rs / tauri-specta

Completely typesafe Tauri commands
MIT License
368 stars 40 forks source link

`__makeEvents__` defined but it's value is never read #96

Closed kareemmahlees closed 5 months ago

kareemmahlees commented 5 months ago

Description

I have no defined events in the backend, so __makeEvents__ is not used. The problem is that when building the application with tsc it fails throwing the following: image

Desired solution

Adding a // @ts-nocheck at the top of the generated file will be sufficient, and even maybe add eslint ignore comments as well.

Environment info

oscartbeaumont commented 5 months ago

Given we can't account for all different configurations and tools we allow the user to define their own header for the file.

You can do the following:

let builder = ts::builder()
            .commands(...)
            .header("// @ts-nocheck\n"); // <- This this appended to the start of the file

As of the current release you will need a \n to ensure it doesn't end up on the same line as the first line of Tauri Specta's runtime however I have fixed that for the next release.

oscartbeaumont commented 5 months ago

I've also added a section to the v2 docs because it was definitely unclear how to solve this before.