Skip to content

Commit b0cc547

Browse files
committed
test: more rigorous type checks
1 parent fafd01b commit b0cc547

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

.scripts/typecheck.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ const packages = await globby([
1414

1515
for (const pkg of packages) {
1616
const cwd = pkg.replace('/package.json', '')
17-
const options = { nodeOptions: { cwd } }
1817

19-
await exec('nuxi', ['prepare'], options)
20-
const res = await exec('tsc', ['--noEmit'], options)
21-
const output = (res.stderr).trim()
22-
if (output) {
23-
consola.withTag(basename(cwd)).error(output)
18+
await exec('nuxi', ['prepare'], { nodeOptions: { cwd }, throwOnError: true })
19+
const res = await exec('tsc', ['--noEmit'], { nodeOptions: { cwd } })
20+
if (res.exitCode !== 0) {
21+
consola.withTag(basename(cwd)).error(res.stdout.trim())
2422
process.exit(1)
2523
}
2624
else {

examples/advanced/use-custom-fetch-composable/nuxt.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ export default defineNuxtConfig({
33
'@nuxt/examples-ui',
44
],
55

6+
runtimeConfig: {
7+
baseURL: '',
8+
},
9+
610
compatibilityDate: '2024-04-03',
711
})

examples/advanced/use-custom-fetch-composable/plugins/customFetch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default defineNuxtPlugin((nuxtApp) => {
33
const config = useRuntimeConfig()
44

55
const $customFetch = $fetch.create({
6-
baseURL: config.baseUrl ?? 'https://api.nuxt.com',
6+
baseURL: config.baseUrl as string ?? 'https://api.nuxt.com',
77
onRequest({ request, options, error }) {
88
if (userAuth.value) {
99
// Add Authorization header
@@ -13,9 +13,9 @@ export default defineNuxtPlugin((nuxtApp) => {
1313
onResponse({ response }) {
1414
// response._data = new myBusinessResponse(response._data)
1515
},
16-
onResponseError({ response }) {
16+
async onResponseError({ response }) {
1717
if (response.status === 401) {
18-
return nuxtApp.runWithContext(() => navigateTo('/login'))
18+
await nuxtApp.runWithContext(() => navigateTo('/login'))
1919
}
2020
},
2121
})

examples/auth/local/auth/server/utils/db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface User {
1111
export async function findUserByEmail(email: string): Promise<User> {
1212
const storage = useStorage()
1313
const key = getUserKey(email!)
14-
return await storage.getItem(key)
14+
return (await storage.getItem(key))!
1515
}
1616

1717
export async function createUser(user: Partial<User>) {

0 commit comments

Comments
 (0)