Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
557 stars 42 forks source link

Having interface with the same name as stdlib type results in incorrect type in runtime #381

Closed trilis closed 3 years ago

trilis commented 4 years ago

Consider library mfiles:

declare namespace MFiles {
    const Number: { new(): INumber; };
    function GetStringResource(resource: number): string;
}
interface INumber {
    Value: number;
    Clone(): INumber;
}

In generated code, in package MFiles we will see this:

external object Number {
}
external fun GetStringResource(resource: Number): String

Which will compile, but type of argument in GetStringResource will not be regular kotlin.Number, as intended by library author, but some irrelevant MFiles.Number.

trilis commented 4 years ago

Same problem with jest/v16:

declare namespace jasmine {
    interface Any {
        new (expectedClass: any): any;
        jasmineMatches(other: any): boolean;
        jasmineToString(): string;
    }
    function any(aclass: any): Any;
}
JSMonk commented 3 years ago

Fixed in #467