custom-electron-titlebar
custom-electron-titlebar copied to clipboard
bug/question: wrong TypeScript declarations?
Describe the bug
The current TypeScript declarations appear to be wrong to me. Importing Titlebar
and Color
doesn't allow proper type usage:
import { Titlebar } from "custom-electron-titlebar"
const titleBar: Titlebar = new Titlebar()
The second statement produces the following error:
'Titlebar' refers to a value, but is being used as a type here. Did you mean 'typeof Titlebar'?
Contents of index.d.ts
are:
import Titlebar from './titlebar';
import { Color } from './common/color';
declare const _default: {
Titlebar: typeof Titlebar;
Color: typeof Color;
};
export = _default;
This issue is new in 4.x.
To Reproduce Steps to reproduce the behavior:
- Create a new TypeScript project
- Add
custom-electron-titlebar
to the project - Import
Titlebar
as shown before
Expected behavior Types should be used "normally".
Desktop (please complete the following information):
- TypeScript version: 4.4.4
- custom-electron-titlebar version: 4.1.0
Same issue here. To be blunt the typings in this project are not the greatest in general right now.
Another issue is that there's no proper way to import anything other than Titlebar
and Color
if you're targeting ECMAScript modules:
These two fail to compile:
While a direct import fails on build since it's not exported by the package:
Is there a reason the main index
file doesn't export the entirety of the package's API?
#188 duplicated