feat: ✨ Aggiunta nuova proprietà `attrsTypes` ai componenti
La proprietà `attrsTypes`, similmente a `prop` di React, permette la tipizzazione degli attributi dei componenti Mithril custom
This commit is contained in:
parent
3c5c2f6586
commit
4fd89f2cba
|
@ -61,6 +61,12 @@ export default class Component<A> implements m.Component<A>, ClassComponent<A> {
|
|||
*/
|
||||
attrs: Attributes<string>;
|
||||
|
||||
/**
|
||||
* The types of the attributes passed into the component. They are used by Typescript to
|
||||
* correctly help typing them.
|
||||
*/
|
||||
attrsTypes: A;
|
||||
|
||||
constructor() {
|
||||
this.element = undefined as unknown as Element;
|
||||
this.attrs = undefined as unknown as Attributes<string>;
|
||||
|
|
|
@ -71,5 +71,9 @@ declare global {
|
|||
'text-field': JSXElement<TextField>;
|
||||
'top-app-bar': JSXElement<TopAppBar>;
|
||||
}
|
||||
|
||||
interface ElementAttributesProperty {
|
||||
attrsTypes?: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue