File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @marko/runtime-tags " : patch
3
+ ---
4
+
5
+ Fix types for return of mounted templates.
Original file line number Diff line number Diff line change @@ -46,8 +46,19 @@ declare global {
46
46
} ;
47
47
48
48
/** The result of calling `template.mount`. */
49
- export type MountedTemplate < Input = unknown , Return = unknown > = {
50
- value : Return ;
49
+ export type MountedTemplate <
50
+ Input = unknown ,
51
+ Return extends void | {
52
+ value : unknown ;
53
+ valueChange ?( next : unknown ) : void ;
54
+ } = void ,
55
+ > = {
56
+ get value ( ) : Return extends { value : infer Value } ? Value : void ;
57
+ set value (
58
+ next : Return extends { valueChange ?( next : infer Next ) : any }
59
+ ? Next
60
+ : never ,
61
+ ) : void ;
51
62
update ( input : Marko . TemplateInput < Input > ) : void ;
52
63
destroy ( ) : void ;
53
64
} ;
@@ -74,7 +85,13 @@ declare global {
74
85
B extends Body < infer Params , any > ? Params : never ;
75
86
76
87
/** The top level api for a Marko Template. */
77
- export abstract class Template < Input = unknown , Return = unknown > {
88
+ export abstract class Template <
89
+ Input = unknown ,
90
+ Return extends void | {
91
+ value : unknown ;
92
+ valueChange ?( next : unknown ) : void ;
93
+ } = void ,
94
+ > {
78
95
/**
79
96
* The folowing types are processed up by the @marko/language-tools
80
97
* and inlined into the compiled template.
You can’t perform that action at this time.
0 commit comments