diff --git a/src/apiutils.ts b/src/apiutils.ts index 1b9ac7ad..59102cbb 100644 --- a/src/apiutils.ts +++ b/src/apiutils.ts @@ -1,6 +1,5 @@ import fuzzy from 'fuzzy'; import {script_v1 as scriptV1} from 'googleapis'; -import {ReadonlyDeep} from 'type-fest'; import {loadAPICredentials, serviceUsage} from './auth'; import {ClaspError} from './clasp-error'; @@ -9,6 +8,8 @@ import {enableOrDisableAdvanceServiceInManifest} from './manifest'; import {ERROR} from './messages'; import {getProjectId, spinner, stopSpinner} from './utils'; +import type {ReadonlyDeep} from 'type-fest'; + type TypeFunction = Readonly; /** diff --git a/src/auth.ts b/src/auth.ts index b2b8d34a..00961ce7 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,18 +1,21 @@ import {Credentials, GenerateAuthUrlOpts, OAuth2Client, OAuth2ClientOptions} from 'google-auth-library'; import {google, script_v1 as scriptV1} from 'googleapis'; -import {createServer, IncomingMessage, Server, ServerResponse} from 'http'; -import {AddressInfo} from 'net'; +import {createServer} from 'http'; import open from 'open'; import readline from 'readline'; -import {ReadonlyDeep} from 'type-fest'; import {URL} from 'url'; import {ClaspError} from './clasp-error'; import {ClaspToken, DOTFILE, Dotfile} from './dotfile'; +import {ERROR, LOG} from './messages'; +import {checkIfOnlineOrDie, getOAuthSettings} from './utils'; // import {oauthScopesPrompt} from './inquirer'; // import {readManifest} from './manifest'; -import {ERROR, LOG} from './messages'; -import {checkIfOnlineOrDie, ClaspCredentials, getOAuthSettings} from './utils'; + +import type {IncomingMessage, Server, ServerResponse} from 'http'; +import type {AddressInfo} from 'net'; +import type {ReadonlyDeep} from 'type-fest'; +import type {ClaspCredentials} from './utils'; /** * Authentication with Google's APIs. diff --git a/src/commands/apis.ts b/src/commands/apis.ts index 67ee9784..37e4fd83 100644 --- a/src/commands/apis.ts +++ b/src/commands/apis.ts @@ -1,7 +1,5 @@ -import {GaxiosResponse} from 'gaxios'; import {discovery_v1 as discoveryV1, serviceusage_v1 as serviceUsageV1} from 'googleapis'; import open from 'open'; -import {ReadonlyDeep} from 'type-fest'; import {PUBLIC_ADVANCED_SERVICES} from '../apis'; import {enableOrDisableAPI} from '../apiutils'; @@ -11,6 +9,9 @@ import {ERROR} from '../messages'; import {URL} from '../urls'; import {checkIfOnlineOrDie, getProjectId} from '../utils'; +import type {GaxiosResponse} from 'gaxios'; +import type {ReadonlyDeep} from 'type-fest'; + type DirectoryItem = Unpacked; type PublicAdvancedService = ReadonlyDeep>>; @@ -31,10 +32,10 @@ export default async (options: CommandOption): Promise => { return await openApiUrl(); } - // @ts-expect-error - const [bin, sourcePath, ...args] = process.argv; - // @ts-expect-error - const [command, subCommand, serviceName] = args; + // @ts-expect-error 'xxx' is declared but its value is never read. + const [_bin, _sourcePath, ...args] = process.argv; + // @ts-expect-error 'xxx' is declared but its value is never read. + const [_command, subCommand, serviceName] = args; // The apis subcommands. const apiSubCommands: {[key: string]: () => Promise} = { diff --git a/src/commands/default.ts b/src/commands/default.ts index fd019553..025ade30 100644 --- a/src/commands/default.ts +++ b/src/commands/default.ts @@ -1,9 +1,9 @@ -import {Command} from 'commander'; -import {ReadonlyDeep} from 'type-fest'; - import {ClaspError} from '../clasp-error'; import {ERROR} from '../messages'; +import type {Command} from 'commander'; +import type {ReadonlyDeep} from 'type-fest'; + /** * Displays a default message when an unknown command is typed. * @param command {string} The command that was typed. diff --git a/src/files.ts b/src/files.ts index f1dd73a4..5015c1ca 100644 --- a/src/files.ts +++ b/src/files.ts @@ -35,7 +35,7 @@ const projectFileWithContent = (file: ProjectFile, transpileOptions: ts.Transpil return type === 'TS' ? // Transpile TypeScript to Google Apps Script // @see github.com/grant/ts2gas - {...file, source: ts2gas(source, transpileOptions), type: 'SERVER_JS'} + {...file, source: ts2gas(source, transpileOptions as any), type: 'SERVER_JS'} : {...file, source, type}; }; @@ -247,7 +247,7 @@ export const isValidFileName = ( name: string, type: string, rootDir: string, - // @ts-expect-error + // @ts-expect-error 'xxx' is declared but its value is never read. normalizedName: string, ignoreMatches: readonly string[] ): boolean => { diff --git a/src/index.ts b/src/index.ts index ed94985f..31de8e2b 100755 --- a/src/index.ts +++ b/src/index.ts @@ -342,8 +342,8 @@ commander */ commander.command('*', {isDefault: true}).description('Any other command is not supported').action(defaultCmd); -// @ts-expect-error -const [bin, sourcePath, ...args] = process.argv; +// @ts-expect-error 'xxx' is declared but its value is never read. +const [_bin, _sourcePath, ...args] = process.argv; // Defaults to help if commands are not provided if (args.length === 0) { commander.outputHelp(); diff --git a/src/inquirer.ts b/src/inquirer.ts index eb8ab73b..c7aebeb8 100644 --- a/src/inquirer.ts +++ b/src/inquirer.ts @@ -1,11 +1,12 @@ import {script_v1 as scriptV1} from 'googleapis'; import {prompt, registerPrompt} from 'inquirer'; import autocomplete from 'inquirer-autocomplete-prompt-ipt'; -import {ReadonlyDeep} from 'type-fest'; import {SCRIPT_TYPES} from './apis'; import {LOG} from './messages'; +import type {ReadonlyDeep} from 'type-fest'; + registerPrompt('autocomplete', autocomplete); export type functionNameSource = (