mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 01:00:05 +00:00
[@types/blessed] Allow additional properties for IOptions interface (#40547)
* [@types/blessed] Allow additional properties for `IOptions` interface
This change allows for arbitrary properties to be stored
onto the options object of `Node` instances. This is useful
for extra metadata to be stored onto a node and is accessible
on the `node.options` property.
For example, the `blessed-css` module utilizes the additional
properties `id` and `className` for matching CSS selectors:
```typescript
const bg = blessed.box({
parent: screen,
id: 'bg'
});
```
* Add test
* Add to authors
This commit is contained in:
committed by
Sheetal Nandi
parent
8b1def9e99
commit
4e575afb73
@@ -53,6 +53,12 @@ screen.key("q", () => screen.destroy());
|
||||
|
||||
screen.render();
|
||||
|
||||
// Allow for arbitrary extra properties to be stored in `options`
|
||||
const extraProps = blessed.box({
|
||||
parent: box1,
|
||||
id: 'box3'
|
||||
});
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-bigtext.js
|
||||
|
||||
screen = blessed.screen({
|
||||
|
||||
5
types/blessed/index.d.ts
vendored
5
types/blessed/index.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Bryn Austin Bellomy <https://github.com/brynbellomy>
|
||||
// Steve Kellock <https://github.com/skellock>
|
||||
// Max Brauer <https://github.com/mamachanko>
|
||||
// Nathan Rajlich <https://github.com/TooTallNate>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@@ -595,7 +596,9 @@ export namespace Widgets {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
interface IOptions {}
|
||||
interface IOptions {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
interface IHasOptions<T extends IOptions> {
|
||||
options: T;
|
||||
|
||||
Reference in New Issue
Block a user