Attempting to utilize @types/stats
with @angular/cli
following the guidance at https://github.com/angular/angular-cli/wiki/stories-third-party-lib. However, encountering a tslint error when trying to
import * as STATS from 'stats.js'
.
[ts] Module '"stats.js"' resolves to a non-module entity and cannot be imported using this construct.
Referencing index.d.ts
of @types/stats.
declare class Stats {
REVISION: number;
dom: HTMLDivElement;
/**
* @param value 0:fps, 1: ms, 2: mb, 3+: custom
*/
showPanel(value: number): void;
begin(): void;
end(): number;
update(): void;
}
declare module "stats.js" {
export = Stats;
}
Regarding src/Stats.js
(Stats.js itself)
https://github.com/mrdoob/stats.js/blob/master/src/Stats.js
The issue may stem from @types/stats
utilizing export =
style exporting.
Hence, considering the use of
import Stats = require('stats.js')
But by default, @angular/cli
employs "module": "es2015"
.
Seeking advice on how to properly import it?