import Base = require(...)
does not mix well with export default class Base
.
If you add console.dir(Base)
to things.ts
, you will see that Base
is actually a module there, not a class:
{ __esModule: true, default: [Function: Base] }
If you change that import in things.ts
to
import Base from './things/Base';
then your example starts working.
The explanation is given in the typescript language specification:
An import require declaration of the form
import m = require("mod");
is equivalent to the ECMAScript 2015 import declaration
import * as m from "mod";
That es6 form always imports m
as a module, even if it contains default export.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…