你也可以做
var Matter = require('matter-js');
或者
import { Engine, World, Body, Bodies, Constraint } from 'matter-js';
@types/matter-js
缺少课程,Common
但也许您无论如何都不应该使用它。如果你真的需要它,你可以把它添加到包中的 index.d.ts 中,
export class Common {
static extend(obj:any, deep?:boolean): any;
static clone(obj:any, deep?:boolean): any;
static keys(obj:any): any;
static values(obj:any): any;
static get(obj:any, path:string, begin:number, end:number): any;
static set(obj:any, path:string, val:any, begin:number, end:number): any;
static shuffle(array:any[]): any;
static choose(choices:any[]): any;
static isElement(obj:any):boolean;
static isArray(obj:any):boolean;
static isFunction(obj:any):boolean;
static isPlainObject(obj:any):boolean;
static isString(obj:any):boolean;
static clamp(value:number, min:number, max:number):number;
static sign(value:number): number;
static now(): number;
static random(min?:number, max?:number): number;
static colorToNumber(colorString:string): number;
static log(...objs:any[]): void;
static info(...objs:any[]): void;
static warn(...objs:any[]): void;
}