https://kotlinlang.org logo
#javascript
Title
# javascript
e

Edoardo Luppi

11/28/2023, 10:09 AM
If I need an hook immediately after the generation of .d.ts files, what would the correct Gradle task be?
a

Artem Kobzar

11/28/2023, 10:13 AM
The type of the task should be
KotlinJsIrLink
e

Edoardo Luppi

11/28/2023, 10:13 AM
Perfect, thanks Artem.
Seems like something is overriding my changes to the types.
Copy code
> Task :parsers:compileDevelopmentLibraryKotlinJs
> Task :parsers:compileDevelopmentLibraryKotlinJsUpdateTsTypes UP-TO-DATE
> Task :parsers:jsDevelopmentLibraryCompileSync UP-TO-DATE
> Task :parsers:jsDevelopmentLibraryValidateGeneratedByCompilerTypeScript
My task
compileDevelopmentLibraryKotlinJsUpdateTsTypes
is executed immediately after the link one, but one of the two that comes after is copying over the files again, or regenerating the types.
Solved. I removed the new task registration, and instead executed the file changes inside a
doLast
Copy code
binaries.withType<JsIrBinary>().configureEach {
  linkTask.configure {
    ...
    doLast {
      updateTypeScriptTypes(destinationDirectory)
    }
  }
}