-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TypeScript definition #11
Conversation
Can you mark properties that are meant as read-only with https://basarat.gitbooks.io/typescript/docs/types/readonly.html |
index.d.ts
Outdated
/** | ||
* TODO | ||
*/ | ||
url: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url: string; | |
url?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the url
option is required: https://github.com/sindresorhus/electron-util/blob/e2ea4fd/index.js#L221-L223
This reverts commit 17b9c8f. # Conflicts: # index.d.ts
@sindresorhus Correct me if I'm wrong, but it seems that there's a type incompatibility here. Both Those accept submenu?: (MenuItemConstructorOptions[]) | (Menu); static buildFromTemplate(template: MenuItemConstructorOptions[]): Menu; These are not compatible with |
Wow. Good catch. Let's change them to return |
I'm gonna open an issue tomorrow about Electron supporting |
That's TypeScript at work! 😄I've been testing these type definitions inside Caprine's codebase, so it got flagged instantly. 🙂 |
Woah. This was a massive undertaking and you did an amazing job at it! 🎉 |
Done: electron/electron#16645 |
Omit<T, Keys> | ||
& { | ||
[K in Keys]-?: Required<Pick<T, K>> | ||
}[Keys] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CvX Would you be willing to submit this to https://github.com/sindresorhus/type-fest ? I'm trying to consolidate the types I use so they can be properly documented and tested in one place.
Extracted from sindresorhus/electron-util#11
Extracted from sindresorhus/electron-util#11
[WIP] There are still a couple of TODOs to be resolved.
edit:
🚀