-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
해결됨
marker.d.ts 관련
24.05.01 15:45 작성 24.05.01 15:47 수정 조회수 81
1
강의에 나오는것처럼 진행했을때
import {LatLng, MapMarkerProps} from 'react-native-maps';
declare module 'react-native-maps' {
export interface MyMapMarkerProps extends MapMarkerProps {
coordinate?: LatLng;
}
}
'MyMapMarkerProps' 인터페이스가 'MapMarkerProps' 인터페이스를 잘못 확장합니다.
'MyMapMarkerProps' 형식은 '{ anchor?: Point | undefined; calloutAnchor?: Point | undefined; calloutOffset?: Point | undefined; centerOffset?: Point | undefined; coordinate: LatLng; ... 22 more ...; zIndex?: number | undefined; }' 형식에 할당할 수 없습니다.
'coordinate' 속성의 형식이 호환되지 않습니다.
'LatLng | undefined' 형식은 'LatLng' 형식에 할당할 수 없습니다.
'undefined' 형식은 'LatLng' 형식에 할당할 수 없습니다.ts(2430)
⚠ Error (TS2430) |
MyMapMarkerProps
인터페이스가 MapMarkerProps
인터페이스를 잘못 확장합니다.
MyMapMarkerProps
형식은 { anchor?: Point | undefined; calloutAnchor?: Point | undefined; calloutOffset?: Point | undefined; centerOffset?: Point | undefined; coordinate: LatLng; ... 22 more ...; zIndex?: number | undefined; }
형식에 할당할 수 없습니다.
동일하게 ?을 넣을 수없는 에러가 생겨서
import {LatLng, MapMarkerProps} from 'react-native-maps';
declare module 'react-native-maps' {
export interface MyMapMarkerProps extends Partial<MapMarkerProps> {
coordinate?: LatLng;
}
}
우선 아래와 같이 처리해 보았습니다만
CustomMarker.tsx에서 MyMapMarkerProps를 못불러오는 문제가 있습니다.
답변을 작성해보세요.
0
0
매력적인홍홍홍
질문자2024.05.01
현재는 extends MapMarkerProps를 뺀 형태로 우선 넘어갔습니다.
interface CustomMarkerProps {
coordinate?: LatLng;
color: MarkerColor;
score?: number;
}
답변 2