-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid erasing types and delegate to js export #39
Avoid erasing types and delegate to js export #39
Conversation
This patch relaxes the constraint on generic types, delegates the non serializable types to JsExport itself so that they can be exported like `any` until we have better support.
common = CommonClassWithMaps() | ||
} | ||
|
||
public var myMap: Map<String, Int> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before this was like public var myMap: Map
exportedType().removeTypeParameter() | ||
exportedType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work! Regarding the comments, I'm afraid that this change implies regression for types with generics. Maybe it was due to a previous Kotlin version and kt 1.7 or 1.8 doesn't require it anymore. Do you mind to investigate a bit further to check if we could have regressions?
Full disclosure, I don't use this tool anymore and don't have access to the original project to check if this is fine or not, so eventually I'll trust your judgement, just let me know ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check. @glureau I saw also that some unit tests are failing, do you mind if I setup a workflow on GitHub Actions to run tests on PRs? for open source repo it should be free.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glureau also I need the approval to run the PR workflow you have: https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I stopped running unit tests and instead only used the typescripts one (kind of integration tests), as I believe they have much more values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like grgit dependency is failing the github CI. Please check locally the output of this script, we'll have to fix the CI later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is failing let me have a look
> Task :compiler:compileKotlin
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/GenericsVisitor.kt: (48, 28): Unchecked cast: Any? to List<KSAnnotation>
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/KspExt.kt: (52, 72): Unchecked cast: Any? to T
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/MethodNameDisambiguation.kt: (36, 68): 'capitalize(): String' is deprecated. Use replaceFirstChar instead.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Structs.kt: (42, 5): Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/mapping/CustomMapping.kt: (184, 42): Parameter 'typeName' is never used, could be renamed to _
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/FunctionTransformer.kt: (31, 53): 'capitalize(): String' is deprecated. Use replaceFirstChar instead.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/SealedClassTransformer.kt: (42, 9): Variable 'ctorParams' is never used
> Task :samples:compileKotlinJs FAILED
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsConsumer.kt: (23, 55): No type arguments expected for external interface GenericsInterface
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsConsumer.kt: (30, 61): No type arguments expected for external interface GenericsInterfaceFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsConsumer.kt: (37, 50): No type arguments expected for class GenericsImpl
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsConsumer.kt: (44, 56): No type arguments expected for class GenericsImplFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsFactory.kt: (22, 57): No type arguments expected for class GenericsImpl
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsFactory.kt: (29, 62): No type arguments expected for class GenericsImplFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (19, 34): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (25, 60): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (26, 35): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (58, 53): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (77, 30): Type of 'bar' doesn't match the type of the overridden var-property 'public abstract var bar: [Error type: Type for error type constructor (GenericsStuff)]<Double>? defined in sample.generics.js.GenericsInterface'
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (77, 43): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (97, 69): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterface.kt: (98, 35): No type arguments expected for external interface GenericsStuff
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (21, 39): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (27, 65): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (28, 40): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (59, 58): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (78, 30): Type of 'bar' doesn't match the type of the overridden var-property 'public abstract var bar: [Error type: Type for error type constructor (GenericsStuffFloat)]<Float>? defined in sample.generics.js.GenericsInterfaceFloat'
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (78, 48): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (98, 74): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/GenericsInterfaceFloat.kt: (99, 40): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (21, 79): No type arguments expected for external interface GenericsInterfaceFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (32, 26): Unresolved reference: bar
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (34, 22): Unresolved reference: bar
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (38, 31): Unresolved reference: fooBar
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (45, 31): Unresolved reference: fooBars
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (53, 31): Unresolved reference: addListener
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (54, 58): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (65, 31): Unresolved reference: baz
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (76, 12): 'bar' overrides nothing
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (76, 48): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (82, 12): 'fooBar' overrides nothing
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (89, 12): 'fooBars' overrides nothing
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (96, 12): 'addListener' overrides nothing
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (96, 74): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (97, 40): No type arguments expected for external interface GenericsStuffFloat
e: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/generics/js/SuperGenericsInterfaceFloat.kt: (109, 12): 'baz' overrides nothing
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':samples:compileKotlinJs'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
// See @KustomExportGenerics | ||
exportedType().removeTypeParameter() | ||
var type = exportedType() | ||
if(isKustomExportAnnotated) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glureau to maintain backward compatibility with KustomGenerics I erased the type only if there is a kustom generic specified for the given type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the output is:
> Task :compiler:compileKotlin
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/GenericsVisitor.kt: (48, 28): Unchecked cast: Any? to List<KSAnnotation>
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/KspExt.kt: (52, 72): Unchecked cast: Any? to T
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/MethodNameDisambiguation.kt: (36, 68): 'capitalize(): String' is deprecated. Use replaceFirstChar instead.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Structs.kt: (42, 5): Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of functional types
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/mapping/CustomMapping.kt: (184, 42): Parameter 'typeName' is never used, could be renamed to _
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/FunctionTransformer.kt: (31, 53): 'capitalize(): String' is deprecated. Use replaceFirstChar instead.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/SealedClassTransformer.kt: (42, 9): Variable 'ctorParams' is never used
> Task :samples:compileKotlinJs
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/_class/sealed/js/ExtendedSealedParent.kt: (19, 11): 'when' is exhaustive so 'else' is redundant here
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/_class/sealed/js/SealedParent.kt: (26, 11): 'when' is exhaustive so 'else' is redundant here
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/Computer.kt: (34, 79): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (38, 68): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (45, 5): Exported declaration uses non-exportable return type: Promise<Unit>
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (46, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (52, 5): The expression is unused
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/IComputer.kt: (35, 79): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/IThingDoer.kt: (40, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/WebThingDoer.kt: (30, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/toplevelfunction/js/addsAsync.kt: (19, 21): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
BUILD SUCCESSFUL in 5s
29 actionable tasks: 29 executed
> Task :samples:compileKotlinJs
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/_class/sealed/js/ExtendedSealedParent.kt: (19, 11): 'when' is exhaustive so 'else' is redundant here
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/_class/sealed/js/SealedParent.kt: (26, 11): 'when' is exhaustive so 'else' is redundant here
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/Computer.kt: (34, 79): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (38, 68): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (45, 5): Exported declaration uses non-exportable return type: Promise<Unit>
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (46, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/ComputerTester.kt: (52, 5): The expression is unused
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/IComputer.kt: (35, 79): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/IThingDoer.kt: (40, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/coroutines/js/WebThingDoer.kt: (30, 13): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
w: /Users/MarcoSignoretto/Documents/careem/KustomExport/samples/build/generated/ksp/js/jsMain/kotlin/sample/toplevelfunction/js/addsAsync.kt: (19, 21): This is a delicate API and its use requires care. Make sure you fully read and understand documentation of the declaration that is marked as a delicate API.
BUILD SUCCESSFUL in 1s
24 actionable tasks: 2 executed, 22 up-to-date
up to date, audited 19 packages in 518ms
found 0 vulnerabilities
✅ Generics: generics interface re-typed
✅ Generics: generics interface re-typed
✅ Generics: generics interface re-typed
✅ Generics: generics interface re-typed
✅ Exceptions: TS can interact with an object containing an Exception
✅ Exceptions: Kotlin can interface with an object containing an Exception
✅ Exceptions: Kotlin can retrieve the stacktrace from the exception
✅ MixingAnnotations: Retrieve data from a @JsExport class
✅ MixingAnnotations: Retrieve data from a @KustomExport class
✅ ValueClass: value class can wrap String
✅ ValueClass: value class can wrap Long
✅ ValueClass: value class can wrap Long
✅ CollectionMapping: mapping for List<Long>
✅ FunctionTypes: mapping for function types
✅ BasicTypeMapping: mapping for Boolean
✅ BasicTypeMapping: mapping for Byte
✅ BasicTypeMapping: mapping for Short
✅ BasicTypeMapping: mapping for Int
✅ BasicTypeMapping: mapping for Float
✅ BasicTypeMapping: mapping for Double
✅ BasicTypeMapping: mapping for String
//TODO: Typed arrays
✅ BasicTypeMapping: mapping for Any
✅ LongMapping: mapping for Long (2147483647)
✅ LongMapping: mapping for Long (4294967295)
✅ Enum: can consume enums in Kotlin code
✅ Enum: values() contains 4 items
✅ Enum: values() contains NORTH
✅ Enum: valueOf(NORTH) -> NORTH
✅ Enum: valueOf(UP) is null
✅ Enum: export doesn't duplicate wrappers
✅ Top-level function: is supported
✅ Top-level function: suspend is supported
✅ Coroutines: execute Kotlin coroutines
✅ Coroutines: execute Kotlin coroutines with 'then'
✅ Coroutines: parallel setTimeout
✅ Coroutines: reject throws an Error
✅ Coroutines: can cancel (timeout throw CancellationException)
✅ Coroutines: can cancel (work is aborted)
✅ Coroutines: can cancel Kotlin coroutines from Typescript (work has been cancelled and will never complete)
✅ InterfaceWithSuspend: executes suspend function with JS friendly types
✅ EmptyClass: can instantiate
✅ SealedClass: Sealed class 1
✅ SealedClass: Sealed class 2
✅ SealedClass: Extended sealed class
✅ SimpleClass: can retrieve value
✅ Inherit: can instantiate
✅ Cascade: direct child
✅ Cascade: sub childs
✅ Statics: static factory can be used
✅ DataClass: created from Kotlin and Typescript are equals
✅ Cascade: direct child
✅ Cascade: sub childs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, it'll handle collections from Kotlin as you need, and current behavior with annotated class is preserved. I presume tho that a kotlin.Result for example could be blocking, but that's ok from my point of view, generics export are really not great. (That's said, it may be better now, my last try was with Kt 1.6)
Thanks for your work! |
Thank you so much, @glureau how can I get a new release with those changes? also any plan to publish to mavenCentral? |
Thanks for your work! The release is available now! https://github.com/deezer/KustomExport/releases/tag/v0.8.2 No plan to publish to mavenCentral yet, as I leaved months ago and recently Deezer stopped using this tool (afaik). It was making more sense at the time of Kotlin 1.5, but a lot of KotlinJs improvements (enum support, interface support, ...) make this tool a little bit too much regarding the original needs that are now covered. From the beginning, this experimental tool was a patch on top of KotlinJS, and the plan was that KotlinJs would cover all those requirements themselves (in a much more efficient way that we can with KSP). Are you using Kt 1.8 or 1.9 and are still loving this tool? If there's enough demands I may take some time for publishing that on mavenCentral. |
Started using it on 1.8 now moved on 1.9, the nice aspects for us is the removal of the package and the simplified d.ts that is generated respect to the original one. |
I remember myself working on another approach, a gradle plugin that remove the package from the js/d.ts directly, to make the transition out of KustomExport easier, and also be able to mix @JsExport and @KustomExport without impacting the package. Unfortunately I didn't move that out of Deezer internal repositories. @SalomonBrys could you check if this is still available and potentially open-source-able? (even a gist could do it, that was only about some regexes) |
This patch will relax the current were the types where erased leading to cases where the generated code won't compile.
Example if you have
map: Map<String, Int>
the ksp generated code will result in:map: Map
this is not ideal because even if the typemap: Map<String, Int>
will be expose as anany
this will still compile and the code is usable anyway.This fixes issues:
#35
#29