24.07.02 15:40 작성
·
76
0
[vue-tsc] Argument of type 'unknown' is not assignable to parameter of type 'string'.
/workspace/dev/nuxt-tutorial/server/routes/auth/login.post.ts:38:20
36 |
37 | const config = useRuntimeConfig();
> 38 | setCookie(event, config.authCookieName, JSON.stringify(userWithoutPassword));
| ^^^^^^^^^^^^^^^^^^^^^
39 |
40 | return {
41 | user: userWithoutPassword,
[vue-tsc] Argument of type 'unknown' is not assignable to parameter of type 'string'.
/workspace/dev/nuxt-tutorial/server/utils/auth.ts:5:43
3 | export function getUserFromEvent(event: H3Event) {
4 | const config = useRuntimeConfig();
> 5 | const userJsonString = getCookie(event, config.authCookieName);
| ^^^^^^^^^^^^^^^^^^^^^
6 |
7 | console.log('userJsonString: ', userJsonString);
config.authCookieName
에서 타입 오류가 발생하는데 어떻게 해결 할 수 있을까요..?
답변 1
0
2024. 07. 02. 20:28
안녕하세요 😀
RuntimeConfig Type 관련해서 아래 링크를 참고하시면 될 것 같습니다.
https://nuxt.com/docs/guide/going-further/runtime-config#typing-runtime-config