Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types in html plugin #1264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/html/src/index.ts
Expand Up @@ -75,7 +75,7 @@ const defaultTemplate = async ({

const supportedFormats = ['es', 'esm', 'iife', 'umd'];

const defaults = {
const defaults: Required<RollupHtmlOptions> = {
attributes: {
link: null,
html: { lang: 'en' },
Expand All @@ -89,11 +89,14 @@ const defaults = {
};

export default function html(opts: RollupHtmlOptions = {}): Plugin {
const { attributes, fileName, meta, publicPath, template, title } = Object.assign(
{},
defaults,
opts
);
const {
attributes,
fileName,
meta,
publicPath,
template,
title
}: Required<RollupHtmlOptions> = Object.assign({}, defaults, opts);

return {
name: 'html',
Expand Down
2 changes: 1 addition & 1 deletion packages/html/types/index.d.ts
Expand Up @@ -15,7 +15,7 @@ export interface RollupHtmlOptions {
fileName?: string;
meta?: Record<string, any>[];
publicPath?: string;
template?: (templateoptions?: RollupHtmlTemplateOptions) => string;
template?: (templateoptions: RollupHtmlTemplateOptions) => string | Promise<string>;
}

export function makeHtmlAttributes(attributes: Record<string, string>): string;
Expand Down