Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed explicit type declarations #12038

Merged
merged 3 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/runJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function spawnJest(
dir: string,
args: Array<string> = [],
options: RunJestOptions = {},
spawnAsync: boolean = false,
spawnAsync = false,
): execa.ExecaSyncReturnValue | execa.ExecaChildProcess {
const isRelative = !path.isAbsolute(dir);

Expand Down
8 changes: 4 additions & 4 deletions packages/expect/src/asymmetricMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Anything extends AsymmetricMatcher<void> {
}

class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
constructor(sample: Array<unknown>, inverse: boolean = false) {
constructor(sample: Array<unknown>, inverse = false) {
super(sample, inverse);
}

Expand Down Expand Up @@ -171,7 +171,7 @@ class ArrayContaining extends AsymmetricMatcher<Array<unknown>> {
}

class ObjectContaining extends AsymmetricMatcher<Record<string, unknown>> {
constructor(sample: Record<string, unknown>, inverse: boolean = false) {
constructor(sample: Record<string, unknown>, inverse = false) {
super(sample, inverse);
}

Expand Down Expand Up @@ -209,7 +209,7 @@ class ObjectContaining extends AsymmetricMatcher<Record<string, unknown>> {
}

class StringContaining extends AsymmetricMatcher<string> {
constructor(sample: string, inverse: boolean = false) {
constructor(sample: string, inverse = false) {
if (!isA('String', sample)) {
throw new Error('Expected is not a string');
}
Expand All @@ -232,7 +232,7 @@ class StringContaining extends AsymmetricMatcher<string> {
}

class StringMatching extends AsymmetricMatcher<RegExp> {
constructor(sample: string | RegExp, inverse: boolean = false) {
constructor(sample: string | RegExp, inverse = false) {
if (!isA('String', sample) && !isA('RegExp', sample)) {
throw new Error('Expected is not a String or a RegExp');
}
Expand Down
5 changes: 1 addition & 4 deletions packages/expect/src/jestMatchersObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ export const setMatchers = <State extends MatcherState = MatcherState>(
[unknown, ...Array<unknown>],
State
> {
constructor(
inverse: boolean = false,
...sample: [unknown, ...Array<unknown>]
) {
constructor(inverse = false, ...sample: [unknown, ...Array<unknown>]) {
super(sample, inverse);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/expect/src/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const matchers: MatchersObject = {
return {actual: received, expected, message, name: matcherName, pass};
},

toBeCloseTo(received: number, expected: number, precision: number = 2) {
toBeCloseTo(received: number, expected: number, precision = 2) {
const matcherName = 'toBeCloseTo';
const secondArgument = arguments.length === 3 ? 'precision' : undefined;
const isNot = this.isNot;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/init/generateConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {defaults, descriptions} from 'jest-config';
const stringifyOption = (
option: keyof Config.InitialOptions,
map: Partial<Config.InitialOptions>,
linePrefix: string = '',
linePrefix = '',
): string => {
const optionDescription = ` // ${descriptions[option]}`;
const stringifiedObject = `${option}: ${JSON.stringify(
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default async (
}

const questions = defaultQuestions.slice(0);
let hasJestProperty: boolean = false;
let hasJestProperty = false;
let projectPackageJson: ProjectPackageJson;

try {
Expand Down Expand Up @@ -99,7 +99,7 @@ export default async (
),
);

let promptAborted: boolean = false;
let promptAborted = false;

// @ts-expect-error: Return type cannot be object - faulty typings
const results: PromptsResults = await prompts(questions, {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function readConfig(
// read individual configs for every project.
skipArgvConfigOption?: boolean,
parentConfigDirname?: Config.Path | null,
projectIndex: number = Infinity,
projectIndex = Infinity,
skipMultipleConfigWarning = false,
): Promise<ReadConfig> {
let rawOptions: Config.InitialOptions;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ export default async function normalize(
initialOptions: Config.InitialOptions,
argv: Config.Argv,
configPath?: Config.Path | null,
projectIndex: number = Infinity,
projectIndex = Infinity,
): Promise<{
hasDeprecationWarnings: boolean;
options: AllOptions;
Expand Down