11import * as fs from "fs" ;
22import * as path from "path" ;
33
4- export function toBooleanConfig ( configValue ) {
4+ export function toBooleanConfig ( configValue : string | boolean ) : boolean {
55 if ( configValue && typeof configValue === 'string' ) {
66 return ( configValue === 'true' )
77 }
8- return configValue
8+ return configValue as boolean
99}
1010
11- export function toArrayConfig ( configValue , separator = ',' , fallback ?: any ) {
11+ export function toArrayConfig ( configValue : string | [ ] , separator = ',' , fallback ?: string [ ] ) : string [ ] {
1212 if ( configValue && typeof configValue === 'string' ) {
1313 return ( configValue . split ( separator ) . map ( arrayItem => arrayItem . trim ( ) ) )
1414 }
1515 return fallback
1616}
1717
18- export function toIntegerConfig ( configValue ) {
18+ export function toIntegerConfig ( configValue : string | number ) : number {
1919 if ( configValue && typeof configValue === 'string' ) {
2020 return parseInt ( configValue )
2121 }
22- return configValue
22+ return configValue as number
2323}
2424
25- export function getGitCommit ( repodir ) {
25+ export function getGitCommit ( repodir : string ) : string {
2626 if ( ! fs . existsSync ( repodir + '/.git/HEAD' ) ) {
2727 return undefined
2828 }
@@ -35,7 +35,7 @@ export function getGitCommit(repodir) {
3535 return reference
3636}
3737
38- export function getGitHubURL ( repo , reference ) {
38+ export function getGitHubURL ( repo : string , reference : string ) : string {
3939 // if it's not a github reference, we handle handle that anyway
4040 if ( ! repo . startsWith ( 'https://github.com' ) && ! repo . startsWith ( 'git@github.com' ) ) {
4141 return repo
0 commit comments