Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Redux-Toolkit
- 프로그래머스코딩테스트
- 코테스터디
- html
- 프로그래머스 Lv.0
- 코테공부
- 프로그래밍
- 코딩
- next.js
- next.js 에러
- CSS
- js
- 알고리즘스터디
- 정보처리기사
- 자바스크립트
- 코테준비
- 개발자
- 프로그래머스알고리즘
- 프로그래머스 코딩테스트
- 정처기기출
- 프로그래머스 알고리즘
- 프로그래머스 코테
- 1일1코테
- 프로그래머스 레벨0
- 프로그래머스코테
- mysql
- 프로그래머스
- 알고리즘공부
- 알고리즘문제
- 코딩테스트
Archives
- Today
- Total
계발하는 개발자
[Svelte + Tinro 라우터 에러] Argument of type 'typeof Route' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent' 에러 해결 본문
❗️Error
[Svelte + Tinro 라우터 에러] Argument of type 'typeof Route' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent' 에러 해결
dev_genie 2023. 11. 22. 17:53참고
https://github.com/AlexxNB/tinro/pull/121/commits/d2251ffed630aac6e76e71856204ead5dd2f6661
에러
tinro 에서 Route 라이브러리 import 해주고 나서 다음 같이 사용하려니 에러가 났다.
Argument of type 'typeof Route' is not assignable to parameter of type 'ConstructorOfATypedSvelteComponent'
원인
발생한 에러 메시지를 확인해보면 Route의 타입이 ConstructorOfATypedSvelteComponent와 일치하지 않는다고 한다.
tinro 라이브러리 타입 정의 파일 확장자가 기본적으로 ts 인데
이 파일에 Route 타입이 별도로 정의되지 않아서 이런 타입 에러가 발생하는 것 같다.
해결
다른 사람이 남긴 Github 이슈를 참고해서 임시적으로 해결했다. (상단 참고 링크)
node_modules > tinro 라이브러리의 타입 정의 파일(index.d.ts)을 수정해주면 된다.
파일 상단에 import type { SvelteComponentTyped } from "svelte"; 추가해주고
export class Route {} 부분 코드 삭제하고, 아래 내용으로 변경해줬다.
type RouteArgs = {
/**
* Exact o relative path of the route
* @default "/*"
*/
path?: string;
/**
* Is route fallback
* @default false
*/
fallback?: boolean;
/**
* Redirect route to the specified path
*/
redirect?: string;
/**
* Will be show only first matched with URL nested route
* @default false
*/
firstmatch?: boolean;
/**
* Name of the route to use in breadcrumbs
* @default null
*/
breadcrumb?: string;
}
export class Route extends SvelteComponentTyped<RouteArgs> {
$$prop_def: {
/**
* Exact o relative path of the route
* @default "/*"
*/
path?: string;
/**
* Is route fallback
* @default false
*/
fallback?: boolean;
/**
* Redirect route to the specified path
*/
redirect?: string;
/**
* Will be show only first matched with URL nested route
* @default false
*/
firstmatch?: boolean;
/**
* Name of the route to use in breadcrumbs
* @default null
*/
breadcrumb?: string;
};
$$slot_def: { default: {
/** Current meta for the route */
meta: TinroRouteMeta
/** @deprecated Use meta.params instead */
params: Record<string, string>
} };
}
결과 화면
LIST
'❗️Error' 카테고리의 다른 글
[Vue3 에러] Component name should always be multi-word 에러 해결 (1) | 2023.11.29 |
---|---|
[Svelte + TS 에러] Cannot find module './App.svelte' or its corresponding type declarations 에러 해결 (1) | 2023.11.22 |
[TailwindCSS] "Unknown at rule @tailwind" css warning 해결 (0) | 2023.11.21 |
[에러 해결] nvm 설치 후 npm 명령어 안먹을때 (1) | 2023.11.08 |
[에러 해결] Extracting 상태에 계속 멈춰있는 현상 해결 (4) | 2023.11.08 |
dev_genie
@dev_genie
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!