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

[TS] Fix FileHeader input type #708

Merged
merged 1 commit into from
Oct 12, 2021
Merged

[TS] Fix FileHeader input type #708

merged 1 commit into from
Oct 12, 2021

Conversation

Shimmi
Copy link
Contributor

@Shimmi Shimmi commented Oct 2, 2021

Issue #, if available: N/A

Description of changes:

Change the FileHeader's defaultMessage input type string[] instead of just string.

Reason:

File Header's defaultMessage is defined as an array in code.

File Header in Examples shows expanding the defaultMessage. E.g. return [...defaultMessage, 'hello world']. TypeScript won't allow this currently due to the string data type.

Altho the current data type works, it implicitly converts the array into a string which results in a malformed header.

// Do not edit directly,Generated on Sat, 02 Oct 2021 12:57:05 GMT
// hello, world!

vs (fixed)

// Do not edit directly
// Generated on Sat, 02 Oct 2021 12:45:13 GMT
// hello, world!

P.S. Is there a way to change the header for every file without the need to specify the custom header formater in every file/platform? Currently, I do following:

Object.keys(config.platforms).forEach((key) => {
    config.platforms[key].options = {fileHeader: 'myHeader', ...config.platforms[key].options}
})

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The input is an array of strings.
@dbanksdesign
Copy link
Member

@Shimmi currently there are no global-level options like fileHeader that cascade down to platforms and then to files. As you point out, you can define a fileHeader at the platform-level and it will get applied to all files in that platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants