Comments (6)
Hello @NickHackman
The Components created by react-blessed are intrinsic types of React and therefore don't require an import, is there a reason to use this approach following other component libraries and requiring imports?
react-blessed
is full-fledged react custom renderer. Therefore its primitive components must be lowercased and don't require import, as if you were using blessed
instead of the DOM. If you had to import components then you would need to rely on an already existing react renderer such as react-dom
, which does not make sense in a shell context.
So we could feasibly remove the prefix of blessed- and capitalize them following React conventions?
If I remember correctly the possibility to add blessed-
to the name was a trick to make intrinsic types work without clashing with react's own type. But capitalizing the names would be against following React conventions in a sense because you would not have any primitive components left, which make no sense. But I agree there is an issue here because you need to use React types and yet you need somehow to override react intrinsic JSX types and I have no idea how to do this.
What do you think?
from react-blessed.
Thanks @NickHackman for the reply.
I've actually switched to a different framework — https://github.com/vadimdemedes/ink
It's actively developed and looks more up to date (along with types).
As for blessed, it doesn't seem to be maintained as you know.
That doesn't necessary signals a problem — maybe it's already ideal and there's no bugs! eh? — but that's unfortunately not the case and their issue queue has ~200 unresolved tickets.
from react-blessed.
new definitions for react-blessed were published yesterday. they use module augmentation on react and jsx to replace html intrinsic elements with react-blessed elements (with and without the blessed-
prefix). I'm not sure they're 100% complete (I didn't write defs for escape
and program
, for example) but they cover the example code and work for a small project I used them in.
from react-blessed.
Therefore its primitive components must be lowercased and don't require import, as if you were using blessed instead of the DOM. If you had to import components then you would need to rely on an already existing react renderer such as react-dom, which does not make sense in a shell context.
Yeah, my bad here had a brain fart. That makes sense!
But I agree there is an issue here because you need to use React types and yet you need somehow to override react intrinsic JSX types and I have no idea how to do this.
I'll look into this while I work on adding the types! Thanks for the answers, I'll link the PR in DefinitelyTyped here when I've added a few types.
from react-blessed.
Folks, honestly it's really hard to understand what is going on here...
Is my understanding correct that no real TypeScript support exists for this module? Basically one doesn't simply use <box>
and expect its gonna compile, right?
After searching and reading many comments I stumbled upon #86 PR after reading which I came to conclusion that I have to rename <box>
to <blessed-box>
. Fine, I did that and my project could finally compile. But.. apart from that no typing is available at all. Looking into react.d.ts
just confirmed my concerns:
declare namespace JSX {
interface IntrinsicElements {
'blessed-box': any;
// ...
So with any
it won't work, indeed. Or am I missing something?
Is it going to be any better or there are some insuperable limitations in the underlying React... contraptions?
P.S. Maybe it's worth mentioning (on this TS situation) in the README? Because it's a little frustrating to discover it after several hours of investigations.
from react-blessed.
@OnkelTem This issue is working on revamping the Typescript types as you found out are quite lacking to the point that they don't really do anything. The current types technically work as any
works fine for components, but won't give you any autocomplete or assistance in debugging. I don't think it's necessary to update the README, and this issue is the first result when looking for "typescript"
Currently DefinitelyTyped PR exists, but I'm not actively using react-blessed and work pulling me a few different ways it's not my top priority. If you'd be willing, I think I have a decent amount of the types setup for that PR if you'd like to contribute to it further or if possible we could merge that in and continue the work elsewhere. If not it'll be done at some point in the future 👍
from react-blessed.
Related Issues (20)
- `useEffect` not working with NODE_ENV=production HOT 3
- readme shows incredible demo, but checked in demo missing rich content HOT 2
- Issue with Overmind state management HOT 1
- Keep the screen content after exit HOT 4
- useEffect hook with empty dependency array called twice HOT 2
- Routing issue
- Question about speed of the new renderer
- react-blessed not working with react-redux HOT 10
- Tear down with useEffect cleanup functions HOT 6
- console.log('screen was destroyed!') in 0.7.1 release HOT 3
- Suspense not working correctly with the react reconciler HOT 1
- no rendered output HOT 5
- Render Array of JSX elements? HOT 4
- `log` element not calling `setContent` on changes
- Confusion regarding styling text
- Example for Midnight Commander-like interface? HOT 4
- Getting the 'image' tag to work HOT 1
- TypeError: Invalid Version: undefined when trying to use react-devtools HOT 1
- Library prints devtools error message to console HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-blessed.