Remove "as Props" from the astro examples (#4494)
This commit is contained in:
parent
b3db2c3c4b
commit
5fbb359afb
8 changed files with 8 additions and 8 deletions
|
@ -5,7 +5,7 @@ export interface Props {
|
||||||
href: string;
|
href: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { href, title, body } = Astro.props as Props;
|
const { href, title, body } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<li class="link-card">
|
<li class="link-card">
|
||||||
|
|
|
@ -3,7 +3,7 @@ export interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title } = Astro.props as Props;
|
const { title } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
|
export interface Props extends astroHTML.JSX.AnchorHTMLAttributes {}
|
||||||
|
|
||||||
const { href, class: className, ...props } = Astro.props as Props;
|
const { href, class: className, ...props } = Astro.props;
|
||||||
const isActive = href === Astro.url.pathname;
|
const isActive = href === Astro.url.pathname;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ export interface Props {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
content: { title, description, pubDate, updatedDate, heroImage },
|
content: { title, description, pubDate, updatedDate, heroImage },
|
||||||
} = Astro.props as Props;
|
} = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
|
|
@ -5,7 +5,7 @@ export interface Props extends Record<any, any> {
|
||||||
|
|
||||||
const { type, ...props } = {
|
const { type, ...props } = {
|
||||||
...Astro.props,
|
...Astro.props,
|
||||||
} as Props;
|
};
|
||||||
|
|
||||||
props.type = type || 'button';
|
props.type = type || 'button';
|
||||||
---
|
---
|
||||||
|
|
|
@ -6,7 +6,7 @@ export interface Props extends Record<any, any> {
|
||||||
|
|
||||||
const { level, role, ...props } = {
|
const { level, role, ...props } = {
|
||||||
...Astro.props,
|
...Astro.props,
|
||||||
} as Props;
|
};
|
||||||
|
|
||||||
props.role = role || 'heading';
|
props.role = role || 'heading';
|
||||||
props['aria-level'] = level || '1';
|
props['aria-level'] = level || '1';
|
||||||
|
|
|
@ -6,7 +6,7 @@ export interface Props {
|
||||||
initialCount?: number;
|
initialCount?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { initialCount = 0 } = Astro.props as Props;
|
const { initialCount = 0 } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="counter" x-data={`{ count: ${initialCount} }`}>
|
<div class="counter" x-data={`{ count: ${initialCount} }`}>
|
||||||
|
|
|
@ -6,7 +6,7 @@ export interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title } = Astro.props as Props;
|
const { title } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
Loading…
Reference in a new issue