Remove "as Props" from the astro examples (#4494)

This commit is contained in:
Mohammed Elhaouari 2022-08-26 15:16:17 +01:00 committed by GitHub
parent b3db2c3c4b
commit 5fbb359afb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 8 additions and 8 deletions

View file

@ -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">

View file

@ -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>

View file

@ -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;
--- ---

View file

@ -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>

View file

@ -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';
--- ---

View file

@ -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';

View file

@ -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} }`}>

View file

@ -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>