Skip to content

Commit

Permalink
Fix unidiomatic typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Jul 12, 2023
1 parent 36a841f commit 14547ab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13285,7 +13285,7 @@ const fs = __importStar(__nccwpck_require__(7147));
const compare_versions_1 = __nccwpck_require__(4773); // compareVersions can be used in the sense of >
// Don't throw on non-zero.
const exec = async (cmd, args) => (0, exec_1.exec)(cmd, args, { ignoreReturnCode: true });
function failed(tool, version) {
async function failed(tool, version) {
throw new Error(`All install methods for ${tool} ${version} failed`);
}
async function configureOutputs(tool, version, path, os) {
Expand Down Expand Up @@ -13731,7 +13731,7 @@ function parseYAMLBoolean(name, val) {
exports.parseYAMLBoolean = parseYAMLBoolean;
function parseURL(name, val) {
if (val === '')
return undefined;
return null;
try {
return new URL(val);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const fs = __importStar(require("fs"));
const compare_versions_1 = require("compare-versions"); // compareVersions can be used in the sense of >
// Don't throw on non-zero.
const exec = async (cmd, args) => (0, exec_1.exec)(cmd, args, { ignoreReturnCode: true });
function failed(tool, version) {
async function failed(tool, version) {
throw new Error(`All install methods for ${tool} ${version} failed`);
}
async function configureOutputs(tool, version, path, os) {
Expand Down
2 changes: 1 addition & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {compareVersions} from 'compare-versions'; // compareVersions can be used
const exec = async (cmd: string, args?: string[]): Promise<number> =>
e(cmd, args, {ignoreReturnCode: true});

function failed(tool: Tool, version: string): void {
async function failed(tool: Tool, version: string): Promise<void> {
throw new Error(`All install methods for ${tool} ${version} failed`);
}

Expand Down
6 changes: 3 additions & 3 deletions src/opts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ProgramOpt {

export interface Options {
ghc: ProgramOpt;
ghcup: {releaseChannel?: URL};
ghcup: {releaseChannel: URL | null};
cabal: ProgramOpt & {update: boolean};
stack: ProgramOpt & {setup: boolean};
general: {matcher: {enable: boolean}};
Expand Down Expand Up @@ -138,8 +138,8 @@ export function parseYAMLBoolean(name: string, val: string): boolean {
);
}

export function parseURL(name: string, val: string): URL | undefined {
if (val === '') return undefined;
export function parseURL(name: string, val: string): URL | null {
if (val === '') return null;
try {
return new URL(val);
} catch (e) {
Expand Down

0 comments on commit 14547ab

Please sign in to comment.