Kotlin / dukat

Converter of <any kind of declarations> to Kotlin external declarations
552 stars 44 forks source link

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

Closed trilis closed 2 years ago

trilis commented 3 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 3 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 2 years ago

Fixed in #467