Skip to content

Commit

Permalink
fix(types): adding registerFileHeader type (#722)
Browse files Browse the repository at this point in the history
Fixes #665
  • Loading branch information
silversonicaxel committed Oct 28, 2021
1 parent 4e3905a commit 54332b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion types/Format.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ export type Formatter = (arguments: FormatterArguments) => string;
export interface Format {
name: string;
formatter: Formatter;
}
}
22 changes: 21 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,26 @@ declare namespace StyleDictionary {
*/
registerFilter(filter: Named<Filter>): this;

/**
* Add a custom file header to Style Dictionary. File headers are used to write a
* custom messasge on top of the generated files.
* @param {String} fileHeader.name The name of the file header to be added
* @param {Function} fileHeader.fileHeader The file header function
* @example
* ```js
* StyleDictionary.registerFileHeader({
* name: 'custmoHeader',
* fileHeader: function(defaultMessage) {
* return return [
* `hello`,
* ...defaultMessage
* ]
* }
* })
* ```
*/
registerFileHeader(fileHeader: Named<{ fileHeader: FileHeader }>): this;

/**
* Adds a custom parser to parse style dictionary files. This allows you to modify
* the design token data before it gets to Style Dictionary or write your
Expand Down Expand Up @@ -306,4 +326,4 @@ declare namespace StyleDictionary {
}

declare var StyleDictionary: StyleDictionary.Core;
export = StyleDictionary;
export = StyleDictionary;

0 comments on commit 54332b3

Please sign in to comment.