-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
src/meta/Base.ts
Outdated
const node = this.nodeHandler.get(key); | ||
|
||
if (!node && !this._requestedNodeKeys.has(key)) { | ||
const handle = this.nodeHandler.on(key, () => { | ||
const handle = this.nodeHandler.on(key as string, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think that we should actually convert this to a string, instead of casting the TS type?
`${key}`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, better than assuming there is some sort of implicit coercion of numbers downstream.
@@ -156,7 +155,7 @@ export class WidgetBase<P = WidgetProperties, C extends DNode = DNode> extends E | |||
/** | |||
* cached chldren map for instance management | |||
*/ | |||
private _cachedChildrenMap: Map<RegistryLabel | Promise<WidgetBaseConstructor> | WidgetBaseConstructor, WidgetCacheWrapper[]>; | |||
private _cachedChildrenMap: Map<string | number | Promise<WidgetBaseConstructor> | WidgetBaseConstructor, WidgetCacheWrapper[]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not RegistryLabel | number |
...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually should never have been registry label, the map always takes the key from properties and uses that (or the widget constructor). So I think it wasn't correct to support symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 cool...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops wrong pr
Type: feature
The following has been addressed in the PR:
Description:
This PR updates the
WidgetProperties
interface so thatkey
can be a number or a string. A newKeyedWidgetProperties
interface was also added that extendsWidgetProperties
and makeskey
required.Resolves #672