Skip to content

Commit f80bd31

Browse files
authored
fix(docs): Marko 5 syntax in TS (#123)
1 parent 7a25890 commit f80bd31

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

docs/reference/typescript.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ All attribute tags are typed as iterable with a `[Symbol.iterator]`, regardless
195195
```marko
196196
/* my-select.marko */
197197
export interface Input {
198-
option: Marko.AttrTag<Marko.Input<"option">>
198+
option: Marko.AttrTag<Marko.HTML.Option>
199199
}
200200
201201
<select>
@@ -207,22 +207,28 @@ export interface Input {
207207

208208
### Extending native tag types within a Marko tag
209209

210-
The types for native tags are accessed via the global `Marko.Input` type. Here's an example of a component that extends the `button` html tag:
210+
The types for native tags are accessed via the global `Marko.HTML` namespace. Here's an example of a component that extends the `button` html tag:
211211

212212
```marko
213213
/* color-button.marko */
214-
export interface Input extends Marko.Input<"button"> {
214+
export interface Input extends Marko.HTML.Button {
215215
color: string;
216-
content?: Marko.Body;
217216
}
218217
219-
$ const { color, ...attrs } = input;
218+
<const/{ color, ...attrs }=input>
220219
221-
<button style=`color: ${color}` ...attrs>
222-
<content/>
223-
</button>
220+
<button style=`color: ${color}` ...attrs/>
224221
```
225222

223+
> [!TIP]
224+
> Since Marko 6, native tags have supported including [`content`](./language.md#tag-content) as an attribute so there is no need to inject manually
225+
> ```marko
226+
> <button style=`color: ${color}` ...attrs>
227+
> // no longer required!
228+
> <${input.content}/>
229+
> </button>
230+
> ```
231+
226232
### Registering a new native tag (e.g. for custom elements)
227233
228234
```ts

0 commit comments

Comments
 (0)