I try to change OrbitControls to TypeScript. How to solve this error:
error TS2345: Argument of type ‘any’ is not assignable to parameter of type ‘never’.
this.dispatchEvent( this._startEvent );
Minimal code that can reproduce the problem:
import {
EventDispatcher
} from 'three';
const _startEvent = { type: 'start' };
const STATE = {
NONE: - 1
let state = STATE.NONE;
class OrbitControls extends EventDispatcher {
constructor( object, domElement ) {
super();
onMouseDown( event ) {
if ( state !== STATE.NONE ) {
this.dispatchEvent( this._startEvent );
export { OrbitControls };
import {
EventDispatcher,
Matrix4,
MOUSE,
OrthographicCamera,
PerspectiveCamera,
Quaternion,
Spherical,
TOUCH,
Vector2,
Vector3,
Plane,
} from 'three'
const _ray = new Ray()
const _plane = new Plane()
const TILT_LIMIT = Math.cos(70 * (Math.PI / 180))
// This set of controls performs orbiting, dollying (zooming), and panning.
Thank you very much! That repository has all classes that I need. I can just copy/paste them to my projects.
They have solved the problem of this topic like this by adding @ts-ignore
:
// @ts-ignore
scope.dispatchEvent(changeEvent)