diff options
-rw-r--r-- | .changeset/perfect-kids-occur.md | 5 | ||||
-rw-r--r-- | packages/astro/components/Markdown.astro | 11 | ||||
-rw-r--r-- | packages/astro/components/Prism.astro | 9 |
3 files changed, 23 insertions, 2 deletions
diff --git a/.changeset/perfect-kids-occur.md b/.changeset/perfect-kids-occur.md new file mode 100644 index 000000000..7617cdcd4 --- /dev/null +++ b/.changeset/perfect-kids-occur.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Adds interfaces for built-in components diff --git a/packages/astro/components/Markdown.astro b/packages/astro/components/Markdown.astro index f2e4f3335..b2639804d 100644 --- a/packages/astro/components/Markdown.astro +++ b/packages/astro/components/Markdown.astro @@ -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} />` diff --git a/packages/astro/components/Prism.astro b/packages/astro/components/Prism.astro index 6aaffbe74..ba4b22ec3 100644 --- a/packages/astro/components/Prism.astro +++ b/packages/astro/components/Prism.astro @@ -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([ |