Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

bug/question: wrong TypeScript declarations? #180

Closed
Znerole opened this issue Mar 3, 2022 · 2 comments
Closed

bug/question: wrong TypeScript declarations? #180

Znerole opened this issue Mar 3, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@Znerole
Copy link

Znerole commented Mar 3, 2022

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:

  1. Create a new TypeScript project
  2. Add custom-electron-titlebar to the project
  3. 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
@TheBentoBox
Copy link

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:

image
image

While a direct import fails on build since it's not exported by the package:
image
image

Is there a reason the main index file doesn't export the entirety of the package's API?

@stale stale bot added the wontfix This will not be worked on label Sep 28, 2022
@stale stale bot closed this as completed Oct 5, 2022
Repository owner deleted a comment from stale bot Oct 6, 2022
@AlexTorresDev AlexTorresDev reopened this Oct 6, 2022
@stale stale bot removed the wontfix This will not be worked on label Oct 6, 2022
@AlexTorresDev AlexTorresDev added the bug Something isn't working label Oct 6, 2022
@AlexTorresDev
Copy link
Owner

AlexTorresDev commented Nov 5, 2022

#188 duplicated

@AlexTorresDev AlexTorresDev added the duplicate This issue or pull request already exists label Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants