Skip to content

Commit c9dbcc1

Browse files
authored
fix(types): fix 388 type errors and fully type src/lib/functions/ (#7130)
* ci: unfortunately build before typecheck/lint * refactor: port go/rust unit tests to TS * refactor: fail a complicated test more gracefully * fix(types): fix functions types and much more * refactor: split `error()` helper to aid typing By separating the version that throws from the version that does not, we can annotate it the former as returning `never`, which trickles down to improving a bunch of other types at call sites. I also cleaned up a bunch of otherwise necessary weird type workarounds like throwing or returning some garbage after having already thrown. I also renamed the method(s) to be clearer. * build: remove resolved temporary suppressions * fix: fix functions regression and fully type `lib/functions/` The args passed to to `.postMessage()` was the regression. * refactor: port functions-serve test file to TS * fix: invoke functions "directly" by default I'm not sure why/whether this is important, but it fixes this test. Regression introduced a few commits earlier in this same PR. This also adds a test that helped me narrow in. * refactor: remove stray comment * fix: avoid potential change in function behaviour * test: test source code in .ts files * Revert "ci: unfortunately build before typecheck/lint" This reverts commit 391c841. * fix(deps): fix local functions for node <18.20.0 * fix(deps): bump local-functions-proxy for bug fix * fix: fix typo regression in error message * refactor: rename `getPackageJson` to clarify intent * fix: don't traverse fs looking for package.json I technically changed these behaviours when I pulled in `read-package-up` in these code paths. This switches to `read-pkg` to keep the previous behaviour. * build: fix eslint regressions from rebase * docs: clarify ambiguous todo comments * refactor: avoid disabling require-await eslint rule * refactor: simplify caught error conditional * fix: make behavioural change slightly safer * fix: revert removal of `plugins[].inputs` * style: fix inline code formatting hint * fix: wrap unknown headers error at runtime * style: consistently use colon after todo comments * refactor: avoid a @ts-expect-error due to is-stream * refactor: use normalize-package-data directly * style: use nullish coalescing
1 parent 919c941 commit c9dbcc1

File tree

119 files changed

+2474
-2346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2474
-2346
lines changed

bin/run.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { argv } from 'process'
44
import updateNotifier from 'update-notifier'
55

66
import { createMainCommand } from '../dist/commands/main.js'
7-
import { error } from '../dist/utils/command-helpers.js'
8-
import getPackageJson from '../dist/utils/get-package-json.js'
7+
import { logError } from '../dist/utils/command-helpers.js'
8+
import getPackageJson from '../dist/utils/get-cli-package-json.js'
99
import { runProgram } from '../dist/utils/run-program.js'
1010

1111
// 12 hours
@@ -17,9 +17,8 @@ try {
1717
pkg,
1818
updateCheckInterval: UPDATE_CHECK_INTERVAL,
1919
}).notify()
20-
} catch (error_) {
21-
error('Error checking for updates:')
22-
error(error_)
20+
} catch (error) {
21+
logError(`Error checking for updates: ${error?.toString()}`)
2322
}
2423

2524
const program = createMainCommand()
@@ -28,6 +27,6 @@ try {
2827
await runProgram(program, argv)
2928

3029
program.onEnd()
31-
} catch (error_) {
32-
program.onEnd(error_)
30+
} catch (error) {
31+
program.onEnd(error)
3332
}

0 commit comments

Comments
 (0)