Skip to content

Fix socket analytics blessed import#331

Merged
jdalton merged 2 commits intomainfrom
fix_widgets
Feb 19, 2025
Merged

Fix socket analytics blessed import#331
jdalton merged 2 commits intomainfrom
fix_widgets

Conversation

@pvdz
Copy link
Contributor

@pvdz pvdz commented Feb 18, 2025

I'm not sure who's wrong here but it looks like import {Widgets} from 'blessed' doesn't actually work. Or at least it doesn't in our build.

Whichever the way, I've imported it as a type such that we can use it for typing in TS but actual code does a deep import (like it did before #323).

This fixes it for me.

@pvdz pvdz requested a review from jdalton February 18, 2025 22:39

function displayAnalyticsScreen(data: FormattedData): void {
const screen = new Widgets.Screen({})
const screen: Widgets.Screen = new ScreenWidget({})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be implicit by the return type of ScreenWidget? does it need to be explicitly added to const screen: Widgets.Screen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS is ignoring the import so ScreenWidget is any. But it should be the same value as what I was expecting Widgets.Screen to be, except importing it fails because apparently Widgets ends up as undefined.

This way we get a typed screen variable, mitigating the impact of the ts-ignore.

@jdalton jdalton merged commit c62fb3c into main Feb 19, 2025
15 checks passed
@jdalton jdalton deleted the fix_widgets branch February 19, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants