Write a declaration file for a default export module

You’re really close. Instead of using export default, you should use export =.

custom-typings/rivescript.d.ts

declare module 'rivescript' {
  class RiveScript {
    constructor()
  }
  export = RiveScript
}

app.js

import RiveScript = require('rivescript');
let rivescript = new RiveScript();

For more info on how to write declaration files, you should have a look at the Typescript Handbook. Eg. they have a template for ‘exporting modules as a class.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)