Skip to content

Commit

Permalink
refactor(typescript): Refactor more files (#12696)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <rhys@arkins.net>
  • Loading branch information
zharinov and rarkins committed Nov 17, 2021
1 parent e95fcb1 commit a7792bc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/types/errors/external-host-error.ts
@@ -1,7 +1,7 @@
import { EXTERNAL_HOST_ERROR } from '../../constants/error-messages';

export class ExternalHostError extends Error {
hostType: string;
hostType: string | undefined;

err: Error;

Expand Down
3 changes: 2 additions & 1 deletion lib/util/mask.spec.ts
Expand Up @@ -2,7 +2,8 @@ import { maskToken } from './mask';

describe('util/mask', () => {
describe('.maskToken', () => {
it('returns value if passed value is falsy', () => {
it('returns empty string if passed value is falsy', () => {
expect(maskToken()).toBe('');
expect(maskToken('')).toBe('');
});

Expand Down
2 changes: 1 addition & 1 deletion lib/util/mask.ts
Expand Up @@ -5,5 +5,5 @@ export function maskToken(str?: string): string {
new Array(str.length - 3).join('*'),
str.slice(-2),
].join('')
: str;
: '';
}
6 changes: 4 additions & 2 deletions test/graphql-snapshot.ts
Expand Up @@ -37,11 +37,13 @@ type Variables = Record<string, string>;
interface SelectionSet {
__vars?: Variables;
__args?: Arguments;
[key: string]: null | SelectionSet | Arguments;
[key: string]: undefined | null | SelectionSet | Arguments;
}

interface GraphqlSnapshot {
query?: SelectionSet;
mutation?: SelectionSet;
subscription?: SelectionSet;
variables?: Record<string, string>;
}

Expand Down Expand Up @@ -81,7 +83,7 @@ function getArguments(key: string, val: ValueNode): Arguments {
}

function simplifyArguments(
argNodes: ReadonlyArray<ArgumentNode>
argNodes?: ReadonlyArray<ArgumentNode>
): Arguments | null {
if (argNodes) {
let result: Arguments = {};
Expand Down
4 changes: 4 additions & 0 deletions tsconfig.strict.json
Expand Up @@ -88,6 +88,7 @@
"./lib/platform/utils/pr-body.ts",
"./lib/proxy.ts",
"./lib/types/branch-status.ts",
"./lib/types/errors/external-host-error.ts",
"./lib/types/git.ts",
"./lib/types/host-rules.ts",
"./lib/types/later.d.ts",
Expand All @@ -108,12 +109,15 @@
"./lib/util/http/types.ts",
"./lib/util/index.ts",
"./lib/util/json-writer/indentation-type.ts",
"./lib/util/mask.spec.ts",
"./lib/util/mask.ts",
"./lib/util/object.ts",
"./lib/util/sanitize.ts",
"./lib/util/split.ts",
"./lib/workers/pr/changelog/hbs-template.ts",
"./lib/workers/pr/changelog/types.ts",
"./lib/workers/repository/init/types.ts",
"./test/graphql-snapshot.ts",
"./test/json-schema.ts",
"./test/newline-snapshot-serializer.ts",
"./test/static-files.spec.ts",
Expand Down

0 comments on commit a7792bc

Please sign in to comment.