refactor(typescript): Refactor more files (#12696)

Co-authored-by: Rhys Arkins <rhys@arkins.net>
This commit is contained in:
Sergei Zharinov 2021-11-17 12:32:33 +03:00 committed by GitHub
parent e95fcb17d8
commit a7792bc5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 5 deletions

View file

@ -1,7 +1,7 @@
import { EXTERNAL_HOST_ERROR } from '../../constants/error-messages';
export class ExternalHostError extends Error {
hostType: string;
hostType: string | undefined;
err: Error;

View file

@ -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('');
});

View file

@ -5,5 +5,5 @@ export function maskToken(str?: string): string {
new Array(str.length - 3).join('*'),
str.slice(-2),
].join('')
: str;
: '';
}

View file

@ -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>;
}
@ -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 = {};

View file

@ -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",
@ -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",