I have a npm module called RiveScript that usually (in Javascript) gets instantiated that way:
var RiveScript = require('rivescript');
var rivescript = new RiveScript();
I'm trying to write a declaration file for the module, but am stuck at the first step. Here's what I've written so far:
declare module "rivescript" {
interface RivescriptOptions {
utf8?: boolean;
}
class RiveScript {
constructor(options?: RivescriptOptions);
}
export default RiveScript;
}
Then I guess in Typescript I would be using the module this way (default import):
import RiveScript from 'rivescript';
let rivescript = new RiveScript();
However, tsc
generates this, which is not valid as it references a default()
function:
const rivescript_1 = require('rivescript');
let rivescript = new rivescript_1.default();
What am I doing wrong?