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): adding registerFileHeader type #722

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/Format.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ export type Formatter = (arguments: FormatterArguments) => string;

export interface Format {
formatter: Formatter;
}
}
22 changes: 21 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,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 @@ -305,4 +325,4 @@ declare namespace StyleDictionary {
}

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