JetBrains/kotlin-wrappers

Need non-sealed sealed external interface PromiseLike<out T>

leerenbo opened this issue · 6 comments

When writing the wrapper for antd's

A type MessageType extends from PromiseLike whick is sealed.

source:
https://github.com/ant-design/ant-design/blob/aa48a3cf4223a422be9d17f4aed2e9fb3aae1003/components/message/interface.ts#L49C1-L51C2

Can the official wrappers maintain the ability of inheritance relationship like in TypeScript? If an interface is inheritable in TypeScript, then do not add “sealed”.

Can the official wrappers maintain the ability of inheritance relationship like in TypeScript? If an interface is inheritable in TypeScript, then do not add “sealed”.

Do you mean, that sealed external interfaces don't exist?
Because all TS interfaces are inheritable.

If all TS interfaces are inheritable,the “sealed” modifier is not needed.

We cannot constrain JavaScript developers. In order to support various types of mappings to the greatest extent, I hope not to use “sealed”.

Without type union, inheritance is used more frequently.

Some necessary “sealed” can be retained. For example, when it comes to the correctness of compiling KotlinJS to JS. If it is just for “when” type judgment and giving up the correctness of wrapping for JS, I don't think it's worth it.

If all TS interfaces are inheritable, the “sealed” modifier is not needed.

It doesn't work in common case unfortunately.
Inheritable in TS != inheritors are welcome. For example - ChildNode, ParentNode

JFYI - PromiseLike can't have non-external implementations in current state (because of overrides).

PR is welcome

Will you create PR?

I will.