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

Don't use unknown for workbox-build method config #3037

Merged
merged 3 commits into from
Mar 2, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/workbox-build/src/generate-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import upath from 'upath';

import {BuildResult, GetManifestOptions} from './types';
import {BuildResult, GetManifestOptions, GenerateSWOptions} from './types';
import {getFileManifestEntries} from './lib/get-file-manifest-entries';
import {rebasePath} from './lib/rebase-path';
import {validateGenerateSWOptions} from './lib/validate-options';
Expand Down Expand Up @@ -193,7 +193,9 @@ import {writeSWUsingDefaultTemplate} from './lib/write-sw-using-default-template
*
* @memberof workbox-build
*/
export async function generateSW(config: unknown): Promise<BuildResult> {
export async function generateSW(
config: GenerateSWOptions,
): Promise<BuildResult> {
const options = validateGenerateSWOptions(config);
let entriesResult;

Expand Down
6 changes: 4 additions & 2 deletions packages/workbox-build/src/get-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {getFileManifestEntries} from './lib/get-file-manifest-entries';
import {GetManifestResult} from './types';
import {GetManifestOptions, GetManifestResult} from './types';
import {validateGetManifestOptions} from './lib/validate-options';

// eslint-disable-next-line jsdoc/newline-after-description
Expand Down Expand Up @@ -88,7 +88,9 @@ import {validateGetManifestOptions} from './lib/validate-options';
*
* @memberof workbox-build
*/
export async function getManifest(config: unknown): Promise<GetManifestResult> {
export async function getManifest(
config: GetManifestOptions,
): Promise<GetManifestResult> {
const options = validateGetManifestOptions(config);

return await getFileManifestEntries(options);
Expand Down
6 changes: 4 additions & 2 deletions packages/workbox-build/src/inject-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import fse from 'fs-extra';
import stringify from 'fast-json-stable-stringify';
import upath from 'upath';

import {BuildResult} from './types';
import {BuildResult, InjectManifestOptions} from './types';
import {errors} from './lib/errors';
import {escapeRegExp} from './lib/escape-regexp';
import {getFileManifestEntries} from './lib/get-file-manifest-entries';
Expand Down Expand Up @@ -117,7 +117,9 @@ import {validateInjectManifestOptions} from './lib/validate-options';
*
* @memberof workbox-build
*/
export async function injectManifest(config: unknown): Promise<BuildResult> {
export async function injectManifest(
config: InjectManifestOptions,
): Promise<BuildResult> {
const options = validateInjectManifestOptions(config);

// Make sure we leave swSrc and swDest out of the precache manifest.
Expand Down
2 changes: 1 addition & 1 deletion packages/workbox-cli/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface BuildCommand {
*/
async function runBuildCommand({command, config, watch}: BuildCommand) {
const {count, filePaths, size, warnings} = await workboxBuild[command](
config,
config as any,
);

for (const warning of warnings) {
Expand Down