@@ -34,16 +34,17 @@ const templateScript = 1,
3434 templateAnonymous = 5
3535
3636export interface TemplateSource {
37- //constructor(element: Node);
38-
3937 text ( ) : string
4038 text ( valueToWrite : string ) : void
39+ text ( valueToWrite ?: string ) : string | void
4140
4241 data ( key : string ) : any
4342 data < T > ( key : string ) : T
4443 data < T > ( key : string , valueToWrite : T ) : void
4544
46- nodes ?: { ( ) : Node ; ( valueToWrite : Node ) : void }
45+ nodes ( ) : Node
46+ nodes ( valueToWrite : Node ) : undefined
47+ nodes ( valueToWrite ?: any ) : Node | undefined
4748}
4849
4950const dataDomDataPrefix = domData . nextKey ( ) + '_'
@@ -144,24 +145,22 @@ export class domElement implements TemplateSource {
144145export class anonymousTemplate extends domElement {
145146 constructor ( element : Element | Comment ) {
146147 super ( element )
147- //The old prototyp construct uses an empty-constructor from domElement, so templateType and element was 'undefined'.
148- //With the new templateType = templateAnonymous (5) we achieve the same behave in the "nodes" Method
148+ //The old prototype construct uses an empty-constructor from domElement, so templateType and element was 'undefined'.
149+ //With the new templateType = templateAnonymous (5) we achieve the same behavior in the "nodes" Method
149150 this . templateType = templateAnonymous
150151 }
151152
152153 override text ( ) : string
153- override text ( valueToWrite : string ) : undefined
154- override text ( /* valueToWrite */ ) : string | undefined {
154+ override text ( valueToWrite : string ) : void
155+ override text ( valueToWrite ?: string ) : string | void {
155156 if ( arguments . length == 0 ) {
156157 const templateData = getTemplateDomData ( this . domElement )
157158 if ( templateData . textData === undefined && templateData . containerData ) {
158159 templateData . textData = templateData . containerData . innerHTML
159160 }
160161 return templateData . textData
161162 } else {
162- const valueToWrite = arguments [ 0 ]
163163 setTemplateDomData ( this . domElement , { textData : valueToWrite } )
164164 }
165- return undefined
166165 }
167166}
0 commit comments