iot-device-simulator icon indicating copy to clipboard operation
iot-device-simulator copied to clipboard

Vanilla build fails with TS error

Open YuChem opened this issue 3 years ago • 1 comments

Describe the bug Tried to build the solution locally. Consistently getting TS compilation error.

The error is thrown during the console build. Same error when using solution build via .sh script or just from source/console folder with npm run build run-unit-tests.sh passes without issues

To Reproduce

  • Check out project
  • set up environment variables
  • run ./build-s3-dist.sh $DIST_BUCKET_PREFIX $SOLUTION_NAME $VERSION

Expected behavior The build script should complete without errors.

Please complete the following information about the solution:

  • [x] Version: v3.0.0
  • [x] Region: us-west-1
  • [ ] Was the solution modified from the version published on this repository?
  • [ ] If the answer to the previous question was yes, are the changes available on GitHub?
  • [ ] Have you checked your service quotas for the sevices this solution uses?
  • [ ] Were there any errors in the CloudWatch Logs?

Screenshots

$ npm run build

> [email protected] build
> GENERATE_SOURCEMAP=false INLINE_RUNTIME_CHUNK=false react-scripts build

Creating an optimized production build...
Failed to compile.

/mnt/c/Temp/iot-device-simulator/source/console/src/views/SimulationDetails.tsx
TypeScript error in /mnt/c/Temp/iot-device-simulator/source/console/src/views/SimulationDetails.tsx(139,25):
Type '{ coordinates: any[][]; }' is not assignable to type 'Coordinates | Feature<Geometry, GeoJsonProperties> | NamedLocation'.
  Types of property 'coordinates' are incompatible.
    Type 'any[][]' is not assignable to type '[number, number]'.
      Target requires 2 element(s) but source may have fewer.  TS2322

    137 |                 drawPoints("IoTMessage",
    138 |                     [
  > 139 |                         {
        |                         ^
    140 |                             coordinates: coordinates,
    141 |                         },
    142 |                     ],

Additional context Environment:

  • WSL2 / Ubuntu 22.04 LTS
  • Node v16.15.1
  • NPM 8.11.0

YuChem avatar Jun 23 '22 13:06 YuChem

The culprit seem to be the maplibre-gl-js-amplify module and its drawPoints API

rolling back to version 1.3.0 of the library works but 1.4.1 and later blows up

YuChem avatar Jun 23 '22 16:06 YuChem