Skip to content

Commit

Permalink
fix: make FileHeader defaultMessage param optional (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema authored Oct 1, 2024
1 parent 26728b9 commit 9376247
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-grapes-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Make `defaultMessage` param in FileHeader type optional.
2 changes: 1 addition & 1 deletion lib/common/formatHelpers/fileHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default async function fileHeader({ file, commentStyle, formatting = {},
/**
* @type {FileHeader}
*/
let fn = (arr) => arr;
let fn = (arr) => arr ?? [];
if (file?.options?.fileHeader && typeof file?.options?.fileHeader !== 'string') {
fn = file.options.fileHeader;
}
Expand Down
2 changes: 1 addition & 1 deletion types/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface FormattingOverrides {
}

export type FileHeader = (
defaultMessage: string[],
defaultMessage?: string[],
options?: Config,
) => Promise<string[]> | string[];

Expand Down

0 comments on commit 9376247

Please sign in to comment.