From 18b0bd20013899cd67ea1bfeb1d06929b40939e8 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Tue, 30 Jan 2024 13:28:30 +0100 Subject: [PATCH] feat: add type attribute to renderScript helper (#30) --- README.md | 1 + src/types.ts | 1 + src/utils.ts | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d737d9c..26a12a3 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ interface Script { defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; + type?: 'importmap' | 'module' | string; } ``` diff --git a/src/types.ts b/src/types.ts index 470fa93..f42acd3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,6 +5,7 @@ export interface Script { defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; + type?: 'importmap' | 'module' | (string & {}); } export interface Stylesheet { diff --git a/src/utils.ts b/src/utils.ts index d9d8928..c47df76 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -10,7 +10,7 @@ export function attrs(obj: Attributes): string { const OG_META_PREFIX = 'og:'; export function getRenderHelpers(params: {nonce?: string}): RenderHelpers { - function renderScript({src, defer, async, crossOrigin}: Script) { + function renderScript({src, defer, async, crossOrigin, type}: Script) { return src ? `` : ''; }