JeremyHeleine / Photo-Sphere-Viewer

A JavaScript library to display Photo Sphere panoramas.
851 stars 943 forks source link

TS2350: Only a void function can be called with the 'new' keyword. #121

Open odmin4eg opened 3 years ago

odmin4eg commented 3 years ago

hi a'm use Vue

<template>
    <div id="viewer"></div>
</template>
<script lang="ts">
...
    import { Viewer } from 'photo-sphere-viewer';

and create new Viewer


  mounted() {
    this.initViewer();
  }

  public initViewer(): void {
    const config = {
      container: document.querySelector('#viewer'),
       panorama: this.images360,
        size: {
          width: '850',
          height: '550'
        }
    };
    this.panoramadata = new Viewer(config);
  };

Result:

ERROR Failed to compile with 1 error ERROR in ./assets/js/components/organizationMap.vue.ts(64,25) TS2350: Only a void function can be called with the 'new' keyword.

line 64 is: this.panoramadata = new Viewer(config); _____^

What am I doing wrong? why such a mistake? Thank you!