oscartbeaumont / tauri-specta

Completely typesafe Tauri commands
MIT License
289 stars 26 forks source link

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

Closed kareemmahlees closed 1 month ago

kareemmahlees commented 1 month 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 1 month 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 1 month ago

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