diff --git a/packages/bundle-size/src/utils/buildFixture.js b/packages/bundle-size/src/utils/buildFixture.js index 99ef2578e5583..aaaa1ace517f7 100644 --- a/packages/bundle-size/src/utils/buildFixture.js +++ b/packages/bundle-size/src/utils/buildFixture.js @@ -129,8 +129,8 @@ module.exports = async function buildFixture(preparedFixture, quiet) { /* eslint-enable @typescript-eslint/naming-convention */ ]); - await fs.writeFile(webpackOutputPath, terserOutput.code); - await fs.writeFile(terserOutputPath, terserOutputMinified.code); + await fs.writeFile(webpackOutputPath, terserOutput.code ?? ''); + await fs.writeFile(terserOutputPath, terserOutputMinified.code ?? ''); if (!quiet) { console.log( diff --git a/packages/bundle-size/src/utils/prepareFixture.js b/packages/bundle-size/src/utils/prepareFixture.js index 2a4ca190f3da3..97e1f30d80ac2 100644 --- a/packages/bundle-size/src/utils/prepareFixture.js +++ b/packages/bundle-size/src/utils/prepareFixture.js @@ -9,6 +9,11 @@ const ajv = new Ajv(); /** @typedef {{ name: string }} FixtureMetadata */ /** @typedef {{ absolutePath: string, relativePath: string, name: string }} PreparedFixture */ +/** + * @template T + * @typedef {NonNullable & {[P in keyof T]-?: NonNullable;}} RequiredNonNullableRecord + */ + /** * Prepares a fixture file to be compiled with Webpack, grabs data from a default export and removes it. * @@ -59,7 +64,7 @@ module.exports = async function prepareFixture(fixture) { /** * @param {typeof result} value - * @return {value is Required> & {metadata: FixtureMetadata}} + * @return {value is RequiredNonNullableRecord & {metadata: FixtureMetadata}} */ function isTransformedFixtureResultHasMetadata(value) { return Boolean(value && value.metadata && Object.keys(value.metadata).length); diff --git a/scripts/exec.js b/scripts/exec.js index 40cd4fd16bbce..1a4a1e108b909 100644 --- a/scripts/exec.js +++ b/scripts/exec.js @@ -42,10 +42,10 @@ function exec(cmd, displayName, cwd = process.cwd(), opts = {}) { ); if (opts.stdout) { - child.stdout.pipe(opts.stdout); + child.stdout?.pipe(opts.stdout); } if (opts.stderr) { - child.stderr.pipe(opts.stderr); + child.stderr?.pipe(opts.stderr); } }); } diff --git a/tools/generators/epic-generator/index.spec.ts b/tools/generators/epic-generator/index.spec.ts index bc0dc6c78accc..f07c47ab82526 100644 --- a/tools/generators/epic-generator/index.spec.ts +++ b/tools/generators/epic-generator/index.spec.ts @@ -45,7 +45,7 @@ function setupTest(packages: Package[]) { // response to 'gh auth' spawnSyncMock.mockReturnValueOnce({ - output: ['Logged in to github.com'], + output: [['Logged in to github.com']], }); // response to epic creation @@ -114,7 +114,7 @@ describe('epic-generator', () => { it('requires you to have logged in with gh', () => { spawnSyncMock.mockReturnValueOnce({ - output: ['You are not logged into any GitHub hosts. Run gh auth login to authenticate.'], + output: [['You are not logged into any GitHub hosts. Run gh auth login to authenticate.']], }); const tree = createTreeWithEmptyWorkspace(); diff --git a/typings/json-stable-stringify-without-jsonify/index.d.ts b/typings/json-stable-stringify-without-jsonify/index.d.ts index 2541e43c77a22..7e2ad7bffad75 100644 --- a/typings/json-stable-stringify-without-jsonify/index.d.ts +++ b/typings/json-stable-stringify-without-jsonify/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for json-stable-stringify-without-jsonify 1.0.1 declare module 'json-stable-stringify-without-jsonify' { - function stringify(value: Record, options?: Partial): Record; + function stringify(value: Record, options?: Partial): string; interface Options { cmp: (a: any, b: any) => any;