wails: Missing declaration file for typescript
I personally use typescript for my javascript projects. I could // @ts-ignore everything, but I made this small declaration file which add the declarations for everything that wails adds. I added the default basic call from the templates.
interface backend {
basic(): Promise<string>;
}
type logFunction = (message: string) => void;
interface wails {
Browser: {
OpenURL(url: string): Promise<void>;
OpenFile(url: string): Promise<void>;
};
Events: {
Emit(eventName: string, ...optionalData: any[]): void;
On(eventName: string, callback: (...optionalData: any[]) => void): void;
};
Log: {
Debug: logFunction;
Error: logFunction;
Fatal: logFunction;
Info: logFunction;
Warning: logFunction;
};
}
declare global {
interface Window {
backend: backend;
wails: wails;
}
}
declare const Bridge: {
Start(callback: () => void): void;
};
export default Bridge;
I could add a pull request, but I first want to know if you guys want it, and how.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 15 (11 by maintainers)
I’m totally down to create a pull request to implement that. I should have time to build that next week.
We could add a boolean to project.json, called
typescriptbindings. This would add the static and dynamic bindings when you callwails serveorwails build. I would prefer this instead of a separate command.Sorry, yes, I’m currently really busy with personal stuff. It’s totally fine to let this wait till after v1.0.0. Sorry for the late response.
Hey @pietdevries94, there’s been a fair bit of work on this that we’d like to test. Are you still available for this? Everything is in place to add the .d.ts file to the runtime.