maps: [Bug]: Typescript conversions fails to compile (ShapeSource, PointAnnotation)
Mapbox Implementation
Mapbox
Mapbox Version
default
Platform
iOS, Android
@rnmapbox/maps version
#main
Standalone component to reproduce
import React from 'react';
import {
MapView,
ShapeSource,
LineLayer,
Camera,
PointAnnotation,
ShapeSource
} from '@rnmapbox/maps';
const aLine = {
type: 'LineString',
coordinates: [
[-74.00597, 40.71427],
[-74.00697, 40.71527],
],
};
class BugReportExample extends React.Component {
render() {
return (
<MapView style={{flex: 1}}>
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<ShapeSource id="idStreetLayer" shape={aLine}>
<LineLayer id="idStreetLayer" />
</ShapeSource>
</MapView>
);
}
}
Observed behavior and steps to reproduce
It doesn’t compile because the files aren’t Typescript.
Expected behavior
It compiles
Notes / preliminary analysis
Provided Typescript files are not compiling
Additional links and references
None
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (5 by maintainers)
@BubbleTrouble14 @mfazekas @mvniekerk
Updated to latest (4.8.4), same problem.
Removing type annotations from PointAnnotation and ShapeSource like this fixed it for me:
to
My app now runs.
This is obviously a temporary fix though, would like to figure out what’s wrong. I’m on a slightly old RN version:
0.68.2
@KiwiKilian I’m not who you referenced, but here is a log after updating from v8 to v10 of my app:
@chrisivo I am freaking out here… I have been working on this for quite a while, but I cannot get it to work. I am getting the same error you mentioned
error: node_modules/@rnmapbox/maps/javascript/components/ShapeSource.tsx: /xxxxx/node_modules/@rnmapbox/maps/javascript/components/ShapeSource.tsx: Unknown node type: "TSInstantiationExpression"But I cannot solve it. This are my
@babelsettings taken from mz projectspackage.jsonThis is the
babel.config.jsand this is from the
package.jsonof@rnmapbox/mapsDo you have a hint why I am still seeing this error?
@allthetime did you check you are actually using 4.8.4 after your upgrade? Try running
npx tsc --version. Our project usestypescript@4.8.4, only if I downgrade to 4.6.4 I can reproduce you problem.@mfazekas
Having the same issue. I just upgraded my packages from an old mapbox-gl version where everything in my app was running fine. Now I get this error upon opening the app. I removed all Mapbox components but kept the import and am still getting the error.
This is an error in library code, not my code.