Skip to content

Commit

Permalink
refactor: type npm-login result (#104)
Browse files Browse the repository at this point in the history
Add type for the return of `npmLogin`.
  • Loading branch information
ComradeVanti authored Jan 14, 2024
1 parent 1a049cf commit c727707
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cmd-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export const login = async function (
return 0;
};

/**
* The result of a login attempt. Either success with the token, or failure.
*/
type LoginResult = { code: 0; token: string } | { code: 1 };

/**
* Return npm login token
*/
Expand All @@ -91,7 +96,7 @@ const npmLogin = async function (
password: string,
email: string,
registry: RegistryUrl
) {
): Promise<LoginResult> {
const client = getNpmClient();
try {
const data = await client.adduser(registry, {
Expand Down

0 comments on commit c727707

Please sign in to comment.