Cristian006/frameless-titlebar

TitleBar platform type conflicts with process.platform type

mgs95 opened this issue · 1 comments

mgs95 commented

Describe the bug
TitleBar platform type is set as "darwin" | "linux" | "win32" | undefined but process.platform type is NodeJS.Platform and both are not compatible so casting is required:

Does not work:

<TitleBar
    platform={process.platform}
> </TitleBar>

Work:

<TitleBar
    platform={process.platform as "darwin" | "linux" | "win32" | undefined}
> </TitleBar>

I think that the type should be accepted and an error should occur if the platform is not supported.

To Reproduce
Steps to reproduce the behavior:

  1. Use typescript
  2. Use TitleBar component with platform property set as process.platform.
  3. See typescript error

Expected behavior
process.platform type accepted by the property.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Desktop (please complete the following information):

  • OS: ubuntu
  • Version: v2.1.4

@mgs95 Thanks for pointing this out, I'll add that into the typings file for the next release but instead of throwing an error for an unsupported platform it will just default to win32 👍