Add interfaces for built-in components (#1292)

* Add interfaces for built-in components

* Adds a changeset
This commit is contained in:
Matthew Phillips 2021-09-01 12:49:01 -07:00 committed by GitHub
parent fba0446666
commit 231964f084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Adds interfaces for built-in components

View file

@ -1,7 +1,16 @@
---
import { renderMarkdown } from '@astrojs/markdown-support';
const { content, $scope } = Astro.props;
export interface Props {
content?: string;
}
// Internal props that should not be part of the external interface.
interface InternalProps extends Props {
$scope: string;
}
const { content, $scope } = Astro.props as InternalProps;
let html = null;
// This flow is only triggered if a user passes `<Markdown content={content} />`

View file

@ -3,7 +3,14 @@ import Prism from 'prismjs';
import { addAstro } from '@astrojs/prism';
import loadLanguages from 'prismjs/components/index.js';
const { class: className, lang, code } = Astro.props;
export interface Props {
class?: string;
lang?: string;
code: string;
}
const { class: className, lang, code } = Astro.props as Props;
let classLanguage = `language-${lang}`
const languageMap = new Map([