Unverified Commit 5a10d256 authored by Anthony Shew's avatar Anthony Shew Committed by GitHub

Getting rid of a few TypeScript anys. (#60017)

Had some spare time and was trying to get more familiar with the
codebase.

Added a few types to `create-next-app` here. Nothing fancy!

---------
Co-authored-by: 's avatarSteven <steven@ceriously.com>
parent f9697190
...@@ -62,8 +62,9 @@ export async function createApp({ ...@@ -62,8 +62,9 @@ export async function createApp({
try { try {
repoUrl = new URL(example) repoUrl = new URL(example)
} catch (error: any) { } catch (error: unknown) {
if (error.code !== 'ERR_INVALID_URL') { const err = error as Error & { code: string | undefined }
if (err.code !== 'ERR_INVALID_URL') {
console.error(error) console.error(error)
process.exit(1) process.exit(1)
} }
......
...@@ -5,6 +5,7 @@ import Commander from 'commander' ...@@ -5,6 +5,7 @@ import Commander from 'commander'
import Conf from 'conf' import Conf from 'conf'
import path from 'path' import path from 'path'
import prompts from 'prompts' import prompts from 'prompts'
import type { InitialReturnValue } from 'prompts'
import checkForUpdate from 'update-check' import checkForUpdate from 'update-check'
import { createApp, DownloadError } from './create-app' import { createApp, DownloadError } from './create-app'
import { getPkgManager } from './helpers/get-pkg-manager' import { getPkgManager } from './helpers/get-pkg-manager'
...@@ -21,7 +22,11 @@ const handleSigTerm = () => process.exit(0) ...@@ -21,7 +22,11 @@ const handleSigTerm = () => process.exit(0)
process.on('SIGINT', handleSigTerm) process.on('SIGINT', handleSigTerm)
process.on('SIGTERM', handleSigTerm) process.on('SIGTERM', handleSigTerm)
const onPromptState = (state: any) => { const onPromptState = (state: {
value: InitialReturnValue
aborted: boolean
exited: boolean
}) => {
if (state.aborted) { if (state.aborted) {
// If we don't re-enable the terminal cursor before exiting // If we don't re-enable the terminal cursor before exiting
// the program, the cursor will remain hidden // the program, the cursor will remain hidden
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment