Kotlin接口导出到Javascript缺少的属性

我在Kotlin中有一个简单的界面,如下所示:

interface IMyInterface { var name: String var description: String } 

用这样的build.gradle文件:

  apply plugin: 'java' apply plugin: 'kotlin2js' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } compileKotlin2Js { kotlinOptions.moduleKind = "umd" kotlinOptions.sourceMap = true } 

它在我输出的时候输出这个javascript:

  (function (root, factory) { if (typeof define === 'function' && define.amd) define(['exports', 'kotlin'], factory); else if (typeof exports === 'object') factory(module.exports, require('kotlin')); else { if (typeof kotlin === 'undefined') { throw new Error("Error loading module 'myModule'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'myModule'."); } root['myModule'] = factory(typeof this['myModule'] === 'undefined' ? {} : this['myModule'], kotlin); } }(this, function (_, Kotlin) { 'use strict'; function IMyInterface() { } IMyInterface.$metadata$ = { kind: Kotlin.Kind.INTERFACE, simpleName: 'IMyInterface', interfaces: [] }; _.IMyInterface = IMyInterface; Kotlin.defineModule('myModule', _); return _; })); 

如果您注意到,导出的JavaScript不包含我的接口定义的任何属性(名称,说明丢失)。

我想看到的是像这样的一个出口:

  IMyInterface = function ( args ) { "use strict"; var _name = ""; Object.defineProperty(this,"name",{ enumerable: true, get: function() { return _name; }, set: function(value) { _name = value; } }); var _description = ""; Object.defineProperty(this,"description",{ enumerable: true, get: function() { return _description; }, set: function(value) { _description = value; } }); 

另外我正在使用kotlin版本1.1.51

谢谢!