Kotlin / dukat

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

Resolve Union type to the common super type (which is not necessarily Any) #373

Open Schahen opened 4 years ago

Schahen commented 4 years ago

Consider following code:

interface Url {}
interface UrlWithParsedQuery extends Url {}

function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;

as of now it's converted to parse with dynamic return type. Reason for this is that we merge both declarations and since UrlWithParsedQuery | Url and it resolved to dynamic.

Suggestion is to resolve to common ancestor which in this particular case is Url.