Skip to content

Commit

Permalink
chore(fix): typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Apr 15, 2024
1 parent 22d01b0 commit 4512cf0
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/commands/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async function cloneMissingRepos(cfg: RootConfig, skipOptional?: boolean) {
`Cloned ${green(cwdRelative(dest))} from`,
repo.url.replace(/^.+:\/\//, '')
)
} catch (err) {
} catch (err: any) {
task.finish()
if (/\bnot (read|found)\b/.test(err.message)) {
return warn(
Expand Down
1 change: 0 additions & 1 deletion src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default (cfg: RootConfig | null) => {
if (name) {
if (!cfg) {
fatal('Missing config. Did you run', cyan('indo init'), 'yet?')
return
}
if (!args.g) {
return linkGlobalPackage(cfg, {
Expand Down
2 changes: 1 addition & 1 deletion src/core/buildPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function buildPackage(pkg: Package) {
const task = startTask(`Building ${cyan(cwdRelative(pkg.root))}`)
try {
await promise
} catch (e) {
} catch (e: any) {
task.finish()
log.error('Build script failed:', yellow(cwdRelative(pkg.root)))
if (isTest) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface JSONCache<T = any> {
find(fn: (value: T, key: string) => boolean): T
}

interface ManagedJSONCache extends JSONCache {
interface ManagedJSONCache<T = any> extends JSONCache<T> {
save(): void
}

Expand All @@ -21,14 +21,14 @@ export function loadCache<T>(
cachePath: string,
onLoad?: (cache: JSONCache<T>) => void
): JSONCache<T> {
let cache: JSONCache<T> = caches[cachePath]
let cache: ManagedJSONCache<T> = caches[cachePath]
if (cache) {
return cache
}
let data: any
try {
data = fs.readJson(cachePath)
} catch (err) {
} catch (err: any) {
if (err.code == fs.NOT_REAL) {
data = {}
} else {
Expand Down
9 changes: 5 additions & 4 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function loadConfig(configPath = findConfig(), force?: boolean) {
let rawConfig: any
try {
rawConfig = fs.readJson(configPath)
} catch (err) {
} catch (err: any) {
if (err.code == fs.NOT_REAL) return null
throw err
}
Expand Down Expand Up @@ -96,9 +96,10 @@ export function createConfig(props?: Partial<Config>): Config {
}
}

export function saveConfig(cfg: RootConfig) {
const copy = {}
const empty = createConfig()
export function saveConfig(cfg: RootConfig): void
export function saveConfig(cfg: any) {
const copy: any = {}
const empty: any = createConfig()
for (const key in cfg) {
if (key in empty && !isDeepEqual(cfg[key], empty[key])) {
copy[key] = cfg[key]
Expand Down
2 changes: 1 addition & 1 deletion src/core/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function parseGitString(
let commit: string | undefined
let subpath: string | undefined

if (gitString?.length > 0) {
if (gitString) {
if (gitString.includes(':')) {
;[gitString, subpath] = gitString.split(':')
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/installPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function installPackages(packages: Package[], force?: boolean) {
task.finish()
log.debug('install completed:', yellow(cwdRelative(pkg.root)))
log.events.emit('install', pkg)
} catch (e) {
} catch (e: any) {
task.finish()
log.error('Installation failed:', yellow(cwdRelative(pkg.root)))
if (isTest) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/sparseClone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function sparseClone(
url: string,
branch: string | undefined,
commit: string | undefined,
subpath: string | undefined
subpath: string
) {
fs.mkdir(dest)
let checkoutCommand = `git clone ${url} . --no-checkout --depth 1`
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"outDir": "dist",
"sourceMap": true,
"strict": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es2018"
}
}

0 comments on commit 4512cf0

Please sign in to comment.